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

Bug #4549 parameters not passed correctly in Renderer::getParams()
Submitted: 2005-06-08 09:49 UTC
From: mrten+pear at ii dot nl Assigned: chagenbu
Status: Closed Package: Text_Diff
PHP Version: 4.3.4 OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [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; } /**

Comments

 [2005-06-12 18:08 UTC] chagenbu
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.