Skip to content

Commit

Permalink
Merge pull request #4377 from yiisoft/patch-pear-textdiff-php-compat
Browse files Browse the repository at this point in the history
Fix "reset() expects parameter 1 to be array" raised by Gii diff, issue #4226 alternative solution
  • Loading branch information
marcovtwout committed Oct 21, 2021
2 parents 3792709 + 71e783b commit 0d9af38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Version 1.1.25 under development
--------------------------------

- Bug #4226: Fix for Gii diff displaying "reset() expects parameter 1 to be array, integer given" (LeoZandvliet, marcovtwout)
- Bug #4369: PHP 8.0 compatibility: Fix warning "Only the first byte will be assigned to the string offset" when generating code with Gii (marcovtwout)
- Bug #4374: Fix for createUpdateCommand which did not accept just a table name when using MSSQL (c-schmitz)

Expand Down
9 changes: 2 additions & 7 deletions framework/gii/components/Pear/Text/Diff/Engine/native.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,15 @@ function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
continue;
}
$matches = $ymatches[$line];
reset($matches);
foreach($matches as $match) {
reset($match);
$y = next($match);
while (($y = array_shift($matches)) !== null) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcsPos($y);
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
break;
}
}
foreach($matches as $match) {
reset($match);
$y = next($match);
while (($y = array_shift($matches)) !== null) {
if ($y > $this->seq[$k - 1]) {
assert($y <= $this->seq[$k]);
/* Optimization: this is a common case: next match is
Expand Down

0 comments on commit 0d9af38

Please sign in to comment.