Home » Text » Text_Diff » Bug #4300
strange diff result
Details
| Submitted | 2005-05-06 23:36 UTC |
|---|---|
| From | franck at exeprod dot com |
| Status | Bogus |
| Package | Text_Diff |
| PHP Version | 4.3.9 |
| OS | fedora core 2 |
| Roadmaps | (Not assigned) |
Comments
[2005-05-06 23:36 UTC] franck at exeprod dot com
Description:
------------
First, not sure this is a bug.
If it's not, should be great this figure in the documentation or an example.
apache 2.0 (prefork) + php 4.3.9 as module, without third party funny engine (like eaccelerator :)
Reproduce code:
---------------
$test1 = array(
"line 1\n",
"line 2\n",
"line 3\n",
"line 4\n",
"line 5\n");
$test2 = array (
"line 1\n",
"line 2\n",
"line modif\n",
"new line\n",
"line 4\n",
"line 5\n");
$diff = new Text_Diff( $test1, $test2 );
$renderer = new Text_Diff_Renderer_inline();
$out = $renderer->render($diff);
Expected result:
----------------
line 1
line 2
line <del>3</del><ins>modif
new line</ins>
line 4
line 5
Actual result:
--------------
line 1
line 2
line <del>3</del><ins>modif</ins>
<ins>new line</ins>
line 4
line 5
[2005-05-06 23:39 UTC] franck at exeprod dot com
Sorry, expect result and actual result are inversed.
You must understand
Actual result:
--------------
line 1
line 2
line <del>3</del><ins>modif
new line</ins>
line 4
line 5
Expected result:
----------------
line 1
line 2
line <del>3</del><ins>modif</ins>
<ins>new line</ins>
line 4
line 5
[2005-05-07 00:20 UTC] franck at exeprod dot com
Seem's change
/* Non-printing newline marker. */
$nl = "\0";
by
/* Non-printing newline marker. */
$nl = '';
resolve my problem ... but .. is not normal ?
Anyway, great job, very usefull PEAR Package.
[2005-05-07 00:22 UTC] franck at exeprod dot com
Sorry again (too tired)
Seem's changing one line in PEAR/Text/Diff/Renderer/inline.php resolve the problem.
/* Non-printing newline marker. */
$nl = "\0";
by
/* Non-printing newline marker. */
$nl = '';
Final notice: i use 0.0.5 version.
[2005-05-07 00:29 UTC] franck at exeprod dot com
Problem not yet solved. My eyes are tired ..
Let's sleep a little before shouting non sense things lol