diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/pomo/streams.php --- a/wp/wp-includes/pomo/streams.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/pomo/streams.php Tue Sep 27 16:37:53 2022 +0200 @@ -17,7 +17,7 @@ /** * PHP5 constructor. */ - function __construct() { + public function __construct() { if ( function_exists( 'mb_substr' ) && ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated ) { @@ -46,7 +46,7 @@ * * @param string $endian Set the endianness of the file. Accepts 'big', or 'little'. */ - function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + public function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid $this->endian = $endian; } @@ -56,7 +56,7 @@ * @return mixed The integer, corresponding to the next 32 bits from * the stream of false if there are not enough bytes or on error */ - function readint32() { + public function readint32() { $bytes = $this->read( 4 ); if ( 4 != $this->strlen( $bytes ) ) { return false; @@ -73,7 +73,7 @@ * @return mixed Array of integers or false if there isn't * enough data or on error */ - function readint32array( $count ) { + public function readint32array( $count ) { $bytes = $this->read( 4 * $count ); if ( 4 * $count != $this->strlen( $bytes ) ) { return false; @@ -88,7 +88,7 @@ * @param int $length * @return string */ - function substr( $string, $start, $length ) { + public function substr( $string, $start, $length ) { if ( $this->is_overloaded ) { return mb_substr( $string, $start, $length, 'ascii' ); } else { @@ -100,7 +100,7 @@ * @param string $string * @return int */ - function strlen( $string ) { + public function strlen( $string ) { if ( $this->is_overloaded ) { return mb_strlen( $string, 'ascii' ); } else { @@ -113,7 +113,7 @@ * @param int $chunk_size * @return array */ - function str_split( $string, $chunk_size ) { + public function str_split( $string, $chunk_size ) { if ( ! function_exists( 'str_split' ) ) { $length = $this->strlen( $string ); $out = array(); @@ -129,21 +129,21 @@ /** * @return int */ - function pos() { + public function pos() { return $this->_pos; } /** * @return true */ - function is_resource() { + public function is_resource() { return true; } /** * @return true */ - function close() { + public function close() { return true; } } @@ -155,7 +155,7 @@ /** * @param string $filename */ - function __construct( $filename ) { + public function __construct( $filename ) { parent::__construct(); $this->_f = fopen( $filename, 'rb' ); } @@ -176,7 +176,7 @@ * @param int $bytes * @return string|false Returns read string, otherwise false. */ - function read( $bytes ) { + public function read( $bytes ) { return fread( $this->_f, $bytes ); } @@ -184,7 +184,7 @@ * @param int $pos * @return bool */ - function seekto( $pos ) { + public function seekto( $pos ) { if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) { return false; } @@ -195,33 +195,29 @@ /** * @return bool */ - function is_resource() { + public function is_resource() { return is_resource( $this->_f ); } /** * @return bool */ - function feof() { + public function feof() { return feof( $this->_f ); } /** * @return bool */ - function close() { + public function close() { return fclose( $this->_f ); } /** * @return string */ - function read_all() { - $all = ''; - while ( ! $this->feof() ) { - $all .= $this->read( 4096 ); - } - return $all; + public function read_all() { + return stream_get_contents( $this->_f ); } } endif; @@ -238,7 +234,7 @@ /** * PHP5 constructor. */ - function __construct( $str = '' ) { + public function __construct( $str = '' ) { parent::__construct(); $this->_str = $str; $this->_pos = 0; @@ -260,7 +256,7 @@ * @param string $bytes * @return string */ - function read( $bytes ) { + public function read( $bytes ) { $data = $this->substr( $this->_str, $this->_pos, $bytes ); $this->_pos += $bytes; if ( $this->strlen( $this->_str ) < $this->_pos ) { @@ -273,7 +269,7 @@ * @param int $pos * @return int */ - function seekto( $pos ) { + public function seekto( $pos ) { $this->_pos = $pos; if ( $this->strlen( $this->_str ) < $this->_pos ) { $this->_pos = $this->strlen( $this->_str ); @@ -284,14 +280,14 @@ /** * @return int */ - function length() { + public function length() { return $this->strlen( $this->_str ); } /** * @return string */ - function read_all() { + public function read_all() { return $this->substr( $this->_str, $this->_pos, $this->strlen( $this->_str ) ); } @@ -306,7 +302,7 @@ /** * PHP5 constructor. */ - function __construct( $filename ) { + public function __construct( $filename ) { parent::__construct(); $this->_str = file_get_contents( $filename ); if ( false === $this->_str ) { @@ -348,7 +344,7 @@ * * @see POMO_CachedIntFileReader::__construct() */ - function POMO_CachedIntFileReader( $filename ) { + public function POMO_CachedIntFileReader( $filename ) { _deprecated_constructor( self::class, '5.4.0', static::class ); self::__construct( $filename ); }