From f2f370cb31b0d2b9d88afa10161b39a1b87af093 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Mar 2018 11:54:19 -0800 Subject: [PATCH] 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 --- includes/libs/xmp/XMP.php | 2 +- includes/libs/xmp/XMPValidate.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ) -- 2.20.1