Commit 20b0e9d0 authored by Steven Wittens's avatar Steven Wittens
Browse files

#15347: PHP5 typecasting error

parent 8365459b
...@@ -617,7 +617,8 @@ function parseResponse($data="") { ...@@ -617,7 +617,8 @@ function parseResponse($data="") {
global $_xh,$xmlrpcerr,$xmlrpcstr; global $_xh,$xmlrpcerr,$xmlrpcstr;
$parser = drupal_xml_parser_create($data); $xmlparser = drupal_xml_parser_create($data);
$parser = (int)$xmlparser;
$_xh[$parser]=array(); $_xh[$parser]=array();
...@@ -629,10 +630,10 @@ function parseResponse($data="") { ...@@ -629,10 +630,10 @@ function parseResponse($data="") {
$_xh[$parser]['ha']=""; $_xh[$parser]['ha']="";
$_xh[$parser]['ac']=""; $_xh[$parser]['ac']="";
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_parser_set_option($xmlparser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($parser, "xmlrpc_se", "xmlrpc_ee"); xml_set_element_handler($xmlparser, "xmlrpc_se", "xmlrpc_ee");
xml_set_character_data_handler($parser, "xmlrpc_cd"); xml_set_character_data_handler($xmlparser, "xmlrpc_cd");
xml_set_default_handler($parser, "xmlrpc_dh"); xml_set_default_handler($xmlparser, "xmlrpc_dh");
$xmlrpc_value=new xmlrpcval; $xmlrpc_value=new xmlrpcval;
if ($this->debug) if ($this->debug)
...@@ -643,7 +644,7 @@ function parseResponse($data="") { ...@@ -643,7 +644,7 @@ function parseResponse($data="") {
error_log("No response received from server."); error_log("No response received from server.");
$r=new xmlrpcresp(0, $xmlrpcerr["no_data"], $r=new xmlrpcresp(0, $xmlrpcerr["no_data"],
$xmlrpcstr["no_data"]); $xmlrpcstr["no_data"]);
xml_parser_free($parser); xml_parser_free($xmlparser);
return $r; return $r;
} }
// see if we got an HTTP 200 OK, else bomb // see if we got an HTTP 200 OK, else bomb
...@@ -654,7 +655,7 @@ function parseResponse($data="") { ...@@ -654,7 +655,7 @@ function parseResponse($data="") {
error_log("HTTP error, got response: " .$errstr); error_log("HTTP error, got response: " .$errstr);
$r=new xmlrpcresp(0, $xmlrpcerr["http_error"], $r=new xmlrpcresp(0, $xmlrpcerr["http_error"],
$xmlrpcstr["http_error"]. " (" . $errstr . ")"); $xmlrpcstr["http_error"]. " (" . $errstr . ")");
xml_parser_free($parser); xml_parser_free($xmlparser);
return $r; return $r;
} }
...@@ -678,21 +679,21 @@ function parseResponse($data="") { ...@@ -678,21 +679,21 @@ function parseResponse($data="") {
$data=$newdata; $data=$newdata;
} }
if (!xml_parse($parser, $data, sizeof($data))) { if (!xml_parse($xmlparser, $data, sizeof($data))) {
// thanks to Peter Kocks <peter.kocks@baygate.com> // thanks to Peter Kocks <peter.kocks@baygate.com>
if((xml_get_current_line_number($parser)) == 1) if((xml_get_current_line_number($xmlparser)) == 1)
$errstr = "XML error at line 1, check URL"; $errstr = "XML error at line 1, check URL";
else else
$errstr = sprintf("XML error: %s at line %d", $errstr = sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($parser)), xml_error_string(xml_get_error_code($xmlparser)),
xml_get_current_line_number($parser)); xml_get_current_line_number($xmlparser));
error_log($errstr); error_log($errstr);
$r=new xmlrpcresp(0, $xmlrpcerr["invalid_return"], $r=new xmlrpcresp(0, $xmlrpcerr["invalid_return"],
$xmlrpcstr["invalid_return"]); $xmlrpcstr["invalid_return"]);
xml_parser_free($parser); xml_parser_free($xmlparser);
return $r; return $r;
} }
xml_parser_free($parser); xml_parser_free($xmlparser);
if ($this->debug) { if ($this->debug) {
print "<pre>---EVALING---[" . print "<pre>---EVALING---[" .
strlen($_xh[$parser]['st']) . " chars]---\n" . strlen($_xh[$parser]['st']) . " chars]---\n" .
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment