Changeset 60771 for trunk/src/wp-includes/SimplePie/src/Gzdecode.php
- Timestamp:
- 09/16/2025 10:45:37 PM (2 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/SimplePie/src/Gzdecode.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/SimplePie/src/Gzdecode.php
r59142 r60771 1 1 <?php 2 2 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 6 declare(strict_types=1); 44 7 45 8 namespace SimplePie; … … 48 11 * Decode 'gzip' encoded HTTP data 49 12 * 50 * @package SimplePie51 * @subpackage HTTP52 13 * @link http://www.gzip.org/format.txt 14 * @link https://www.php.net/manual/en/function.gzdecode.php 15 * @deprecated since SimplePie 1.9.0, use `gzdecode` function instead. 53 16 */ 54 17 class Gzdecode … … 180 143 * @param mixed $value 181 144 */ 182 public function __set( $name, $value)145 public function __set(string $name, $value) 183 146 { 184 147 throw new Exception("Cannot write property $name"); … … 190 153 * @param string $data 191 154 */ 192 public function __construct( $data)155 public function __construct(string $data) 193 156 { 194 157 $this->compressed_data = $data; … … 225 188 $mtime = substr($this->compressed_data, $this->position, 4); 226 189 // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness 227 if (current( unpack('S', "\x00\x01")) === 1) {190 if (current((array) unpack('S', "\x00\x01")) === 1) { 228 191 $mtime = strrev($mtime); 229 192 } 230 $this->MTIME = current( unpack('l', $mtime));193 $this->MTIME = current((array) unpack('l', $mtime)); 231 194 $this->position += 4; 232 195 … … 249 212 250 213 // Get the length of the extra field 251 $len = current( unpack('v', substr($this->compressed_data, $this->position, 2)));214 $len = current((array) unpack('v', substr($this->compressed_data, $this->position, 2))); 252 215 $this->position += 2; 253 216 … … 301 264 if ($this->compressed_size >= $this->min_compressed_size) { 302 265 // Read the CRC 303 $crc = current( unpack('v', substr($this->compressed_data, $this->position, 2)));266 $crc = current((array) unpack('v', substr($this->compressed_data, $this->position, 2))); 304 267 305 268 // Check the CRC matches … … 315 278 316 279 // Decompress the actual data 317 if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) { 318 return false; 319 } 320 280 if (($data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) { 281 return false; 282 } 283 284 $this->data = $data; 321 285 $this->position = $this->compressed_size - 8; 322 286 323 287 // Check CRC of data 324 $crc = current( unpack('V', substr($this->compressed_data, $this->position, 4)));288 $crc = current((array) unpack('V', substr($this->compressed_data, $this->position, 4))); 325 289 $this->position += 4; 326 290 /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) … … 330 294 331 295 // Check ISIZE of data 332 $isize = current( unpack('V', substr($this->compressed_data, $this->position, 4)));296 $isize = current((array) unpack('V', substr($this->compressed_data, $this->position, 4))); 333 297 $this->position += 4; 334 298 if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) {
Note: See TracChangeset
for help on using the changeset viewer.