From: Brion Vibber Date: Fri, 9 Mar 2018 19:54:19 +0000 (-0800) Subject: Fix XMPReader/XMPValidator for PHP 7 X-Git-Tag: 1.31.0-rc.0~342 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=f2f370cb31b0d2b9d88afa10161b39a1b87af093;p=lhc%2Fweb%2Fwiklou.git Fix XMPReader/XMPValidator for PHP 7 Tripped up by old typos being caught in new warnings on PHP 7.x: was checking a scalar's count when meant to check its containing array's count, and was using a str "\0" where a literal 0 should have been used (now considered non-numeric). Tested locally on 7.2 Bug: T182365 Change-Id: If79a73032d6b63cc41135ccafb6900aeb7787b02 --- diff --git a/includes/libs/xmp/XMP.php b/includes/libs/xmp/XMP.php index 1955915890..6a4d7c42d4 100644 --- a/includes/libs/xmp/XMP.php +++ b/includes/libs/xmp/XMP.php @@ -838,7 +838,7 @@ class XMPReader implements LoggerAwareInterface { return; } - if ( count( $this->mode[0] ) === 0 ) { + if ( count( $this->mode ) === 0 ) { // This should never ever happen and means // there is a pretty major bug in this class. throw new RuntimeException( 'Encountered end element with no mode' ); diff --git a/includes/libs/xmp/XMPValidate.php b/includes/libs/xmp/XMPValidate.php index 7aec28e635..9fe3e335e4 100644 --- a/includes/libs/xmp/XMPValidate.php +++ b/includes/libs/xmp/XMPValidate.php @@ -206,7 +206,7 @@ class XMPValidate implements LoggerAwareInterface { $this->logger->info( __METHOD__ . " Flash structure did not have all the required components" ); $val = null; } else { - $val = ( "\0" | ( $val['Fired'] === 'True' ) + $val = ( 0 | ( $val['Fired'] === 'True' ) | ( intval( $val['Return'] ) << 1 ) | ( intval( $val['Mode'] ) << 3 ) | ( ( $val['Function'] === 'True' ) << 5 )