PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Text » Text_Diff » Bug #4879

Text_Diff_Renderer_inline hangs on numbers in input string

Details

Submitted2005-07-22 06:04 UTC
Fromalex-spam at rdc dot ru
Assignedchagenbu
StatusClosed
PackageText_Diff
PHP Version4.3.10
OSWindows, Linux
Roadmaps(Not assigned)

Comments

[2005-07-22 06:04 UTC] alex-spam at rdc dot ru

Description:
------------
It seems to me that I've found a bug in Text_Diff_Renderer_inline of Text_Diff version 0.0.5. The renderer seems to choke on numbers, hanging script execution.

Test script:
---------------
<h2>Text_Diff_Renderer_inline bug demonstration</h2>
<?

# uncomment this line to see script hanging
$want_bug = TRUE;

include_once 'Text/Diff.php';
include_once 'Text/Diff/Renderer.php';
include_once 'Text/Diff/Renderer/inline.php';
include_once 'Text/Diff/Renderer/unified.php';

$oldtext = <<<EOT
Common text
Bob had 1 apple, Alice had 2.
Bon appetit!
EOT;

$newtext = <<< EOT
Common text
Bob had 10 apples, Alice had 1.
Bon appetit!
EOT;

$oldpieces = explode ("\n", $oldtext);
$newpieces = explode ("\n", $newtext);
$diff =& new Text_Diff ($oldpieces, $newpieces);

# up to this line script execution goes fine

if (@$want_bug)
{ # this block hangs
$renderer =& new Text_Diff_Renderer_inline ();
$out = $renderer->render ($diff);
} else
{ # this block works normally
$renderer =& new Text_Diff_Renderer_unified ();
$out = $renderer->render ($diff);
}

echo "<b>out:</b><br>\n". nl2br ($out);

?>

Expected result:
----------------
Inline renderer should produce output, but it hangs.

Actual result:
--------------
Inline renderer hangs, so it's no output.