External Libraries: Update the SimplePie library to version 1.5.7.

This version shows significant improvements in the compatibility of SimplePie with PHP 8.0, 8.1, and even contains an initial PHP 8.2 fix. The release also contains a number of other bug fixes.

Release notes: https://github.com/simplepie/simplepie/releases/tag/1.5.7

For a full list of changes in this update, see the SimplePie GitHub:
https://github.com/simplepie/simplepie/compare/1.5.6...1.5.7

Follow-up to [47733], [49176].

Props jrf, SergeyBiryukov.
Fixes #54659.

git-svn-id: https://develop.svn.wordpress.org/trunk@52393 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-12-20 19:31:37 +00:00
parent e169c4923b
commit 61dbb11d70
11 changed files with 217 additions and 26 deletions

View File

@@ -164,12 +164,30 @@ class SimplePie_Parser
xml_set_element_handler($xml, 'tag_open', 'tag_close');
// Parse!
if (!xml_parse($xml, $data, true))
$wrapper = @is_writable(sys_get_temp_dir()) ? 'php://temp' : 'php://memory';
if (($stream = fopen($wrapper, 'r+')) &&
fwrite($stream, $data) &&
rewind($stream))
{
//Parse by chunks not to use too much memory
do
{
$stream_data = fread($stream, 1048576);
if (!xml_parse($xml, $stream_data === false ? '' : $stream_data, feof($stream)))
{
$this->error_code = xml_get_error_code($xml);
$this->error_string = xml_error_string($this->error_code);
$return = false;
break;
}
} while (!feof($stream));
fclose($stream);
}
else
{
$this->error_code = xml_get_error_code($xml);
$this->error_string = xml_error_string($this->error_code);
$return = false;
}
$this->current_line = xml_get_current_line_number($xml);
$this->current_column = xml_get_current_column_number($xml);
$this->current_byte = xml_get_current_byte_index($xml);