Edit report at http://pear.php.net/bugs/bug.php?id=14533&edit=1
ID: 14533
Updated by: jan@horde.org
Reported By: alex dot chumak at gmail dot com
Summary: No output when comparing two one-line strings using
'string' engine
-Status: Assigned
+Status: Closed
Type: Bug
Package: Text_Diff
Operating System: centos linux
Package Version: 1.0.0
PHP Version: 5.1.6
Assigned To: yunosh
Roadmap Versions:
New Comment:
-Status: Assigned
+Status: Closed
This bug has been fixed in CVS.
If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should
be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
The correct fix actually was to make sure that the diff string ends
with a line break.
Previous Comments:
------------------------------------------------------------------------
[2008-10-16 13:31:33] alexchumak
It seems that because you removed both array_shift, in the string
engine for diffs that are missing headers there is no further need to do
$end = count($diff)-1
right now it seems to be missing the last operation
fixed by changing back to $end = count($diff)
------------------------------------------------------------------------
[2008-09-10 04:58:56] yunosh
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download
at
http://pear.php.net/get/Text_Diff
------------------------------------------------------------------------
[2008-08-20 17:07:44] alexchumak
Description:
------------
I loaded a 'unified' diff string that was stored in db.
Selected 'inline' renderer but it produced no output even though the
diff contains a '-' and '+' lines.
In cases where there were multiple lines there was output, which
sometimes seemed to be off in complex cases.
I fixed no output issues by commenting out one of the two array_shift's
in 'string' engine's diff function as there is only one line of header,
so it seems that it was unshifting one of the operations. Also, changed
$end = count($diff)-1 to $end=count($diff) in parseUnifiedDiff. Probably
the same should be done to parseContextDiff
Test script:
---------------
@@ -1 +1 @@
-For the first time in U.S. history number of private contractors and
troops are equal
+Number of private contractors and troops are equal for first time in
U.S. history
Expected result:
----------------
strike-out sentence and show the changes in green
Actual result:
--------------
no output at all
------------------------------------------------------------------------