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 » Web Services » XML_RPC » Bug #382

Undefined index: ac in XML/RPC.php at line 342

Details

Submitted2003-12-08 21:23 UTC
Fromraymond at dotsphinx dot com
Assignedpajoye
StatusClosed
PackageXML_RPC
PHP Version4.3.2
OSGNU/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)));