Skip to content

Commit f19a41d

Browse files
lazyfroschThomas-Gelf
authored andcommitted
php-diff: Fix undefined offset in Array Renderer
See chrisboulton/php-diff#51
1 parent 09f4a1c commit f19a41d

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

library/vendor/php-diff/SOURCE

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,34 @@
33
set -ex
44

55
# version based on current master 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7
6-
# plus https://github.com/chrisboulton/php-diff/pull/50
6+
# plus pull requests:
7+
# - https://github.com/chrisboulton/php-diff/pull/50
8+
# - https://github.com/chrisboulton/php-diff/pull/51
9+
710
git clone https://github.com/chrisboulton/php-diff.git
811

912
cd php-diff
1013

11-
git fetch origin pull/50/head:pr
12-
git checkout a9f124f81a9436138879e56157c6cced52a6d95b
13-
git show -s
14+
# master
15+
git checkout 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7
16+
17+
# PR #50
18+
git fetch origin pull/50/head:pr-50
19+
git cherry-pick a9f124f81a9436138879e56157c6cced52a6d95b
20+
21+
# PR #51
22+
git fetch origin pull/51/head:pr-51
23+
git cherry-pick cb0d0781bcc6b0ae39d73715c659a6d2717d28e1
24+
25+
git log -4
1426

1527
rm -rf .git
1628
rm -rf .gitignore
1729
rm -rf composer.json
1830
rm -rf example tests phpunit.xml
1931
cd ..
32+
33+
echo "Now you can run:"
34+
echo " rsync -av php-diff/ ./ --delete --exclude=SOURCE --exclude=php-diff/"
35+
echo "and:"
36+
echo " rm -rf php-diff/"

library/vendor/php-diff/lib/Diff/Renderer/Html/Array.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,14 @@ protected function formatLines($lines)
190190
*/
191191
private function fixSpaces(array $matches)
192192
{
193-
$spaces = $matches[1];
194-
$count = strlen($spaces);
195-
if($count == 0) {
193+
$count = 0;
194+
195+
if (count($matches) > 1) {
196+
$spaces = $matches[1];
197+
$count = strlen($spaces);
198+
}
199+
200+
if ($count == 0) {
196201
return '';
197202
}
198203

0 commit comments

Comments
 (0)