Home » Web Services » XML_RPC » Bug #382
Undefined index: ac in XML/RPC.php at line 342
Details
| 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) |
Comments
[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'] = '';
+ }
}
}
[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)));