Running PHP 5 I got a type casting error because the xmlrpc.inc uses the resource handle to create and array key. Bad idea.

the bug


$parser = drupal_xml_parser_create($data);

    $_xh[$parser]=array();

    $_xh[$parse]['st']="";
    $_xh[$parser]['cm']=0;
    $_xh[$parser]['isf']=0;
    $_xh[$parser]['ac']="";
    $_xh[$parser]['qt']="";
    $_xh[$parser]['ha']="";
    $_xh[$parser]['ac']="";

    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
    xml_set_element_handler($parser, "xmlrpc_se", "xmlrpc_ee");
    xml_set_character_data_handler($parser, "xmlrpc_cd");
    xml_set_default_handler($parser, "xmlrpc_dh");
    $xmlrpc_value=new xmlrpcval;


the fix

$parser = drupal_xml_parser_create($data);

	$parserKey = (int)$parser;
    $_xh[$parserKey]=array();

    $_xh[$parserKey]['st']="";
    $_xh[$parserKey]['cm']=0;
    $_xh[$parserKey]['isf']=0;
    $_xh[$parserKey]['ac']="";
    $_xh[$parserKey]['qt']="";
    $_xh[$parserKey]['ha']="";
    $_xh[$parserKey]['ac']="";

    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
    xml_set_element_handler($parser, "xmlrpc_se", "xmlrpc_ee");
    xml_set_character_data_handler($parser, "xmlrpc_cd");
    xml_set_default_handler($parser, "xmlrpc_dh");
    $xmlrpc_value=new xmlrpcval;

Comments

Steven’s picture

The easiest way to get your changes into core is to open a bug tracker issue, attach a patch and set the status to "patch". It will show up in the patch queue where everyone can easily find it.

I applied a modified version of the patch to cvs. There were more lines below the ones you mentioned which are affected by this issue.

carlmcdade’s picture

I tried to post an issue but I was unsure where it should go. There was nothing for includes and I was not sure if this was part of a particular module.
---------------------------
info for Drupal installation
__________________________
Carl McDade
Information Technology Consult
Team Macromedia
www.hivemindz.com
www.fireorb.org

sepeck’s picture

here
http://drupal.org/patch

for a core item, it would be the Drupal project.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

carlmcdade’s picture

I just checked the file change. Though I did not post more than a piece of the code here I did do all of the functions found using the same technique in the file similarly. The new file submitted to CVS only does one function in the file.

This was the reason for the question mark on this because it is something that that maybe requires a rewrite.
---------------------------
info for Drupal installation
__________________________
Carl McDade
Information Technology Consult
Team Macromedia
www.hivemindz.com
www.fireorb.org