PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Text » Text_Diff » Bug #4549

parameters not passed correctly in Renderer::getParams()

Details

Submitted2005-06-08 09:49 UTC
Frommrten+pear at ii dot nl
Assignedchagenbu
StatusClosed
PackageText_Diff
PHP Version4.3.4
OSlinux
Roadmaps(Not assigned)

Comments

[2005-06-08 09:49 UTC] mrten+pear at ii dot nl

Description:
------------
i found a bug in Renderer.php:

if you use Text_Diff_Renderer_inline and try to pass parameters to the constructor, the parameters will be ignored. this is because getParams() gives back the parameters with an '_' prepended, which won't work in when they get used again in Text_Diff_Renderer_inline's _changed() function.

Reproduce code:
---------------
here's a patch:

diff -Nru Text_Diff-0.0.5/Diff/Renderer.php ../Diff/Renderer.php
--- Text_Diff-0.0.5/Diff/Renderer.php Wed May 4 23:39:51 2005
+++ ../Diff/Renderer.php Wed Jun 8 00:43:57 2005
@@ -45,9 +45,13 @@
*
* @return array All parameters of this renderer object.
*/
- function getParams()
- {
- return get_object_vars($this);
+ function getParams() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $k=>$v) {
+ if ($k[0]=='_') $k = substr($k,1);
+ $varnew[$k]=$v;
+ }
+ return $varnew;
}

/**