Skip to content

Commit

Permalink
php-diff: Fix undefined offset in Array Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyfrosch authored and Thomas-Gelf committed May 29, 2018
1 parent 09f4a1c commit f19a41d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
25 changes: 21 additions & 4 deletions library/vendor/php-diff/SOURCE
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,34 @@
set -ex

# version based on current master 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7
# plus https://github.com/chrisboulton/php-diff/pull/50
# plus pull requests:
# - https://github.com/chrisboulton/php-diff/pull/50
# - https://github.com/chrisboulton/php-diff/pull/51

git clone https://github.com/chrisboulton/php-diff.git

cd php-diff

git fetch origin pull/50/head:pr
git checkout a9f124f81a9436138879e56157c6cced52a6d95b
git show -s
# master
git checkout 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7

# PR #50
git fetch origin pull/50/head:pr-50
git cherry-pick a9f124f81a9436138879e56157c6cced52a6d95b

# PR #51
git fetch origin pull/51/head:pr-51
git cherry-pick cb0d0781bcc6b0ae39d73715c659a6d2717d28e1

git log -4

rm -rf .git
rm -rf .gitignore
rm -rf composer.json
rm -rf example tests phpunit.xml
cd ..

echo "Now you can run:"
echo " rsync -av php-diff/ ./ --delete --exclude=SOURCE --exclude=php-diff/"
echo "and:"
echo " rm -rf php-diff/"
11 changes: 8 additions & 3 deletions library/vendor/php-diff/lib/Diff/Renderer/Html/Array.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,14 @@ protected function formatLines($lines)
*/
private function fixSpaces(array $matches)
{
$spaces = $matches[1];
$count = strlen($spaces);
if($count == 0) {
$count = 0;

if (count($matches) > 1) {
$spaces = $matches[1];
$count = strlen($spaces);
}

if ($count == 0) {
return '';
}

Expand Down

0 comments on commit f19a41d

Please sign in to comment.