PHP 7.4 fixes

All errors currently seen in Travis:
* Function ReflectionType::__toString() is deprecated
* Trying to access array offset on value of type null
* Array and string offset access syntax with curly braces is
  deprecated

Bug: T233012
Change-Id: I9619fcae5dd8b633f8c579b924aec311343da880
This commit is contained in:
Max Semenik 2019-11-22 00:00:47 -08:00 committed by Thiemo Kreuz (WMDE)
parent a05255635b
commit 986fe3bd33
3 changed files with 14 additions and 10 deletions

View file

@ -143,11 +143,14 @@ class ConditionalHeaderUtil {
/**
* The strong comparison function
*
* @param array $tag1 Parsed tag info array
* @param array $tag2 Parsed tag info array
* @param array|null $tag1 Parsed tag info array
* @param array|null $tag2 Parsed tag info array
* @return bool
*/
private function strongCompare( $tag1, $tag2 ) {
if ( $tag1 === null || $tag2 === null ) {
return false;
}
return !$tag1['weak'] && !$tag2['weak'] && $tag1['contents'] === $tag2['contents'];
}
}

View file

@ -188,9 +188,9 @@ class WebPHandler extends BitmapHandler {
// Bytes 0-3 are 'VP8L'
// Bytes 4-7 are chunk stream size
// Byte 8 is 0x2F called the signature
if ( $header{8} != "\x2F" ) {
if ( $header[8] != "\x2F" ) {
wfDebugLog( 'WebP', __METHOD__ . ': Invalid signature: ' .
bin2hex( $header{8} ) . "\n" );
bin2hex( $header[8] ) . "\n" );
return [];
}
// Bytes 9-12 contain the image size

View file

@ -91,7 +91,13 @@ trait FactoryArgTestTrait {
$pos = $param->getPosition();
$type = (string)$param->getType();
$type = $param->getType();
if ( !$type ) {
// Optimistically assume a string is okay
return "some unlikely string $pos";
}
$type = $type->getName();
if ( $type === 'array' ) {
return [ "some unlikely string $pos" ];
@ -101,11 +107,6 @@ trait FactoryArgTestTrait {
return $this->createMock( $type );
}
if ( $type === '' ) {
// Optimistically assume a string is okay
return "some unlikely string $pos";
}
$this->fail( "Unrecognized parameter type $type" );
}