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

Bug #382 Undefined index: ac in XML/RPC.php at line 342
Submitted: 2003-12-08 21:23 UTC
From: raymond at dotsphinx dot com Assigned: pajoye
Status: Closed Package: XML_RPC
PHP Version: 4.3.2 OS: GNU/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2003-12-08 21:23 UTC] raymond at dotsphinx dot com
Description: ------------ I ran into a case where XML_RPC uses an uninitialised variable: Undefined index: ac in /home/dotsphin/public_html/share/php/pear/XML/RPC.php at line 342 A quick search on the net showed that the problem was already present in useful inc's code: http://article.gmane.org/gmane.comp.php.xml-rpc/51 The following patch fixes the problem: --- RPC.php.orig 2003-12-08 19:36:54.000000000 +0100 +++ RPC.php 2003-12-08 22:22:52.000000000 +0100 @@ -337,11 +337,14 @@ $XML_RPC_xh[$parser]['lv']=2; } - // replace characters that eval would - // do special things with - @$XML_RPC_xh[$parser]['ac'].=str_replace('$', '\$', - str_replace('"', '\"', str_replace(chr(92), - $XML_RPC_backslash, $data))); + // EXPERIMENTAL FIX: + if(array_key_exists('ac', $XML_RPC_xh[$parser])) { + $XML_RPC_xh[$parser]['ac'].=str_replace('$', '\$', + str_replace('"', '\"', str_replace(chr(92), + $XML_RPC_backslash, $data))); + } else { + $XML_RPC_xh[$parser]['ac'] = ''; + } } }

Comments

 [2004-03-15 10:27 UTC] pajoye
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.
 [2004-04-09 12:35 UTC] pash_ka at fonbet dot info
This fix introduced a new bug http://pear.php.net/bugs/bug.php?id=1170 The correct fix shoud be // replace characters that eval would // do special things with if (!isset($XML_RPC_xh[$parser]['ac'])) { $XML_RPC_xh[$parser]['ac'] = ''; } $XML_RPC_xh[$parser]['ac'] .= str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92), $XML_RPC_backslash, $data)));