Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Bug #14533 No output when comparing two one-line strings using 'string' engine
Submitted: 2008-08-20 21:07 UTC
From: alexchumak Assigned: yunosh
Status: Closed Package: Text_Diff (version 1.0.0)
PHP Version: 5.1.6 OS: centos linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-08-20 21:07 UTC] alexchumak (Alex Chumak)
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

Comments

 [2008-09-10 08:58 UTC] yunosh (Jan Schneider)
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-10-16 17:31 UTC] alexchumak (Alex Chumak)
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)
 [2009-07-24 18:29 UTC] yunosh (Jan Schneider)
-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.