XML-RPC: Explicitly unset the reference to the parser resource after calling xml_parser_free() to avoid memory leaks in PHP 7.0.0 or higher.
Props procifer, ayeshrajans. Fixes #49700. Built from https://develop.svn.wordpress.org/trunk@48322 git-svn-id: http://core.svn.wordpress.org/trunk@48091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -110,20 +110,28 @@ class IXR_Message
|
||||
$chunk_size = apply_filters( 'xmlrpc_chunk_parsing_size', $chunk_size );
|
||||
|
||||
$final = false;
|
||||
|
||||
do {
|
||||
if (strlen($this->message) <= $chunk_size) {
|
||||
$final = true;
|
||||
}
|
||||
|
||||
$part = substr($this->message, 0, $chunk_size);
|
||||
$this->message = substr($this->message, $chunk_size);
|
||||
|
||||
if (!xml_parse($this->_parser, $part, $final)) {
|
||||
xml_parser_free($this->_parser);
|
||||
unset($this->_parser);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($final) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
xml_parser_free($this->_parser);
|
||||
unset($this->_parser);
|
||||
|
||||
// Grab the error messages, if any
|
||||
if ($this->messageType == 'fault') {
|
||||
|
||||
Reference in New Issue
Block a user