Make WordPress Core


Ignore:
Timestamp:
12/20/2021 07:31:37 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/SimplePie/Parser.php

    r47733 r52393  
    165165
    166166            // Parse!
    167             if (!xml_parse($xml, $data, true))
    168             {
    169                 $this->error_code = xml_get_error_code($xml);
    170                 $this->error_string = xml_error_string($this->error_code);
     167            $wrapper = @is_writable(sys_get_temp_dir()) ? 'php://temp' : 'php://memory';
     168            if (($stream = fopen($wrapper, 'r+')) &&
     169                fwrite($stream, $data) &&
     170                rewind($stream))
     171            {
     172                //Parse by chunks not to use too much memory
     173                do
     174                {
     175                    $stream_data = fread($stream, 1048576);
     176                    if (!xml_parse($xml, $stream_data === false ? '' : $stream_data, feof($stream)))
     177                    {
     178                        $this->error_code = xml_get_error_code($xml);
     179                        $this->error_string = xml_error_string($this->error_code);
     180                        $return = false;
     181                        break;
     182                    }
     183                } while (!feof($stream));
     184                fclose($stream);
     185            }
     186            else
     187            {
    171188                $return = false;
    172189            }
     190
    173191            $this->current_line = xml_get_current_line_number($xml);
    174192            $this->current_column = xml_get_current_column_number($xml);
Note: See TracChangeset for help on using the changeset viewer.