Skip to content

Commit

Permalink
Coding Standards: Rename the $gzData argument to $gz_data in `WP_…
Browse files Browse the repository at this point in the history
…Http_Encoding::compatible_gzinflate()`.

This fixes a `Variable "$gzData" is not in valid snake_case format` WPCS warning.

Follow-up to [11684].

See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@52150 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 12, 2021
1 parent 85333a6 commit 133a3dd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/wp-includes/class-wp-http-encoding.php
Expand Up @@ -97,38 +97,38 @@ public static function decompress( $compressed, $length = null ) {
* @link https://www.php.net/manual/en/function.gzinflate.php#70875
* @link https://www.php.net/manual/en/function.gzinflate.php#77336
*
* @param string $gzData String to decompress.
* @param string $gz_data String to decompress.
* @return string|false Decompressed string on success, false on failure.
*/
public static function compatible_gzinflate( $gzData ) {
public static function compatible_gzinflate( $gz_data ) {

// Compressed data might contain a full header, if so strip it for gzinflate().
if ( "\x1f\x8b\x08" === substr( $gzData, 0, 3 ) ) {
if ( "\x1f\x8b\x08" === substr( $gz_data, 0, 3 ) ) {
$i = 10;
$flg = ord( substr( $gzData, 3, 1 ) );
$flg = ord( substr( $gz_data, 3, 1 ) );
if ( $flg > 0 ) {
if ( $flg & 4 ) {
list($xlen) = unpack( 'v', substr( $gzData, $i, 2 ) );
list($xlen) = unpack( 'v', substr( $gz_data, $i, 2 ) );
$i = $i + 2 + $xlen;
}
if ( $flg & 8 ) {
$i = strpos( $gzData, "\0", $i ) + 1;
$i = strpos( $gz_data, "\0", $i ) + 1;
}
if ( $flg & 16 ) {
$i = strpos( $gzData, "\0", $i ) + 1;
$i = strpos( $gz_data, "\0", $i ) + 1;
}
if ( $flg & 2 ) {
$i = $i + 2;
}
}
$decompressed = @gzinflate( substr( $gzData, $i, -8 ) );
$decompressed = @gzinflate( substr( $gz_data, $i, -8 ) );
if ( false !== $decompressed ) {
return $decompressed;
}
}

// Compressed data from java.util.zip.Deflater amongst others.
$decompressed = @gzinflate( substr( $gzData, 2 ) );
$decompressed = @gzinflate( substr( $gz_data, 2 ) );
if ( false !== $decompressed ) {
return $decompressed;
}
Expand Down

0 comments on commit 133a3dd

Please sign in to comment.