return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
}
}
+
+// gzdecode function only exists in PHP >= 5.4.0
+// http://php.net/gzdecode
+if ( !function_exists( 'gzdecode' ) ) {
+ /**
+ * @codeCoverageIgnore
+ * @return string
+ */
+ function gzdecode( $data ) {
+ return gzinflate( substr( $data, 10, -8 ) );
+ }
+}
/// @endcond
/**
if ( $gzipped_contents === false ) {
$this->fail( "Could not get contents of $fname" );
}
- // We resort to use gzinflate instead of gzdecode, as gzdecode
- // need not be available
- $contents = gzinflate( substr( $gzipped_contents, 10, -8 ) );
- $this->assertEquals( strlen( $contents ),
- file_put_contents( $fname, $contents ), "# bytes written" );
+
+ $contents = gzdecode( $gzipped_contents );
+
+ $this->assertEquals(
+ strlen( $contents ),
+ file_put_contents( $fname, $contents ),
+ '# bytes written'
+ );
}
/**