mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 21:30:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@48322 602fd350-edb4-49c9-b593-d223f7449a82
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