Make WordPress Core


Ignore:
Timestamp:
09/16/2025 10:45:37 PM (2 months ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update the SimplePie library to version 1.9.0.

References:

Follow-up to [59141], [60490].

Props swissspidy, TobiasBg, SergeyBiryukov.
Fixes #63961.

File:
1 edited

Legend:

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

    r59141 r60771  
    11<?php
    22
    3 /**
    4  * SimplePie
    5  *
    6  * A PHP-Based RSS and Atom Feed Framework.
    7  * Takes the hard work out of managing a complete RSS/Atom solution.
    8  *
    9  * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
    10  * All rights reserved.
    11  *
    12  * Redistribution and use in source and binary forms, with or without modification, are
    13  * permitted provided that the following conditions are met:
    14  *
    15  *  * Redistributions of source code must retain the above copyright notice, this list of
    16  *    conditions and the following disclaimer.
    17  *
    18  *  * Redistributions in binary form must reproduce the above copyright notice, this list
    19  *    of conditions and the following disclaimer in the documentation and/or other materials
    20  *    provided with the distribution.
    21  *
    22  *  * Neither the name of the SimplePie Team nor the names of its contributors may be used
    23  *    to endorse or promote products derived from this software without specific prior
    24  *    written permission.
    25  *
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
    27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    28  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
    29  * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    33  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    34  * POSSIBILITY OF SUCH DAMAGE.
    35  *
    36  * @package SimplePie
    37  * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
    38  * @author Ryan Parman
    39  * @author Sam Sneddon
    40  * @author Ryan McCue
    41  * @link http://simplepie.org/ SimplePie
    42  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
    43  */
     3// SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
     4// SPDX-License-Identifier: BSD-3-Clause
     5
     6declare(strict_types=1);
    447
    458namespace SimplePie\XML\Declaration;
     
    4710/**
    4811 * Parses the XML Declaration
    49  *
    50  * @package SimplePie
    51  * @subpackage Parsing
    5212 */
    5313class Parser
     
    13999     * @param string $data Input data
    140100     */
    141     public function __construct($data)
     101    public function __construct(string $data)
    142102    {
    143103        $this->data = $data;
     
    151111     * @return bool true on success, false on failure
    152112     */
    153     public function parse()
     113    public function parse(): bool
    154114    {
    155115        while ($this->state && $this->state !== self::STATE_EMIT && $this->has_data()) {
     
    162122        }
    163123
    164         $this->version = '';
    165         $this->encoding = '';
    166         $this->standalone = '';
     124        // Reset the parser state.
     125        $this->version = '1.0';
     126        $this->encoding = 'UTF-8';
     127        $this->standalone = false;
    167128        return false;
    168129    }
     
    174135     * @return bool true if there is further data, false if not
    175136     */
    176     public function has_data()
     137    public function has_data(): bool
    177138    {
    178139        return (bool) ($this->position < $this->data_length);
     
    193154    /**
    194155     * Read value
     156     *
     157     * @return string|false
    195158     */
    196159    public function get_value()
     
    209172    }
    210173
    211     public function before_version_name()
     174    public function before_version_name(): void
    212175    {
    213176        if ($this->skip_whitespace()) {
     
    218181    }
    219182
    220     public function version_name()
     183    public function version_name(): void
    221184    {
    222185        if (substr($this->data, $this->position, 7) === 'version') {
     
    229192    }
    230193
    231     public function version_equals()
     194    public function version_equals(): void
    232195    {
    233196        if (substr($this->data, $this->position, 1) === '=') {
     
    240203    }
    241204
    242     public function version_value()
    243     {
    244         if ($this->version = $this->get_value()) {
     205    public function version_value(): void
     206    {
     207        if ($version = $this->get_value()) {
     208            $this->version = $version;
    245209            $this->skip_whitespace();
    246210            if ($this->has_data()) {
     
    254218    }
    255219
    256     public function encoding_name()
     220    public function encoding_name(): void
    257221    {
    258222        if (substr($this->data, $this->position, 8) === 'encoding') {
     
    265229    }
    266230
    267     public function encoding_equals()
     231    public function encoding_equals(): void
    268232    {
    269233        if (substr($this->data, $this->position, 1) === '=') {
     
    276240    }
    277241
    278     public function encoding_value()
    279     {
    280         if ($this->encoding = $this->get_value()) {
     242    public function encoding_value(): void
     243    {
     244        if ($encoding = $this->get_value()) {
     245            $this->encoding = $encoding;
    281246            $this->skip_whitespace();
    282247            if ($this->has_data()) {
     
    290255    }
    291256
    292     public function standalone_name()
     257    public function standalone_name(): void
    293258    {
    294259        if (substr($this->data, $this->position, 10) === 'standalone') {
     
    301266    }
    302267
    303     public function standalone_equals()
     268    public function standalone_equals(): void
    304269    {
    305270        if (substr($this->data, $this->position, 1) === '=') {
     
    312277    }
    313278
    314     public function standalone_value()
     279    public function standalone_value(): void
    315280    {
    316281        if ($standalone = $this->get_value()) {
Note: See TracChangeset for help on using the changeset viewer.