Summary | Failed asserts in Text_Diff in 'native' engine |
Queue | Horde Framework Packages |
Type | Bug |
State | Feedback |
Priority | 2. Medium |
Owners | |
Requester | cpigott (at) rapitasystems (dot) com |
Created | 11/24/2017 (2728 days ago) |
Due | |
Updated | 09/23/2018 (2425 days ago) |
Assigned | 01/22/2018 (2669 days ago) |
Resolved | |
Milestone | |
Patch | No |
$a="a =
print (a)
print ()
print (a)
print ()
print (a)
";
$b = "a =
print ()
print (a)
print ()
print (a)
print ()
";
$diff = new Horde_Text_Diff('auto',[explode("\n",$a),explode("\n",$b)]);
produces:
PHP Warning: assert(): assert($y <= $this->seq[$k]) failed in
/usr/share/pear/Horde/Text/Diff/Engine/Native.php on line 199
PHP Stack trace:
PHP 1. {main}() /var/www/util/compute_metrics.php:0
PHP 2. Horde_Text_Diff->__construct() /var/www/util/compute_metrics.php:198
PHP 3. Horde_Text_Diff_Engine_Native->diff()
/usr/share/pear/Horde/Text/Diff.php:47
PHP 4. Horde_Text_Diff_Engine_Native->_compareseq()
/usr/share/pear/Horde/Text/Diff/Engine/Native.php:86
PHP 5. Horde_Text_Diff_Engine_Native->_diag()
/usr/share/pear/Horde/Text/Diff/Engine/Native.php:283
PHP 6. assert() /usr/share/pear/Horde/Text/Diff/Engine/Native.php:199
a minimal test case have failed so far. However, it seems to be
related to multiple diff "blocks", and having a change in combination
with an addition.
I'll keep trying to get an actual example...
State ⇒ Feedback
Priority ⇒ 2. Medium
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Failed asserts in Text_Diff in 'native' engine
Type ⇒ Bug
State ⇒ Unconfirmed
spewing out warnings about failed asserts:
PHP Warning: assert(): assert($y <= $this->seq[$k]) failed in
<snip>/Horde/Text/Diff/Engine/Native.php on line 199
PHP Warning: assert(): assert($ypos != $this->seq[$end]) failed in
<snip>/Horde/Text/Diff/Engine/Native.php on line 239
Some searching brought up a WordPress bug report [1] where they
backported commit 65f92a [2] and noticed the same issue. They didn't
really come up with a proper fix themselves - just "reverting" to
using current() and next() instead of each(). That doesn't seem like a
proper solution to me - it's still relying on mashing the internal
array pointer that was why each() was deprecated in the first place,
but regardless it does the job.
In my searching I also found
#4497[3], which seems like it could berelated to this issue, despite it being a decade old
[1] https://core.trac.wordpress.org/ticket/41526
[2]
https://github.com/horde/Text_Diff/commit/65f92a945f3745be2953d2bcc24735e860cf70a7
[3] https://bugs.horde.org/ticket/4997