From 55beff7635904b3fabdb2a585c0e88704d8ab56d Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 5 Dec 2013 12:36:30 +0100 Subject: [PATCH] Remove function calls from for loop test part in media classes Change-Id: Ic9a677e9c678da873d936bad62dddbce7891dd07 --- includes/media/Exif.php | 8 ++++++-- includes/media/IPTC.php | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/media/Exif.php b/includes/media/Exif.php index a0d5e954ce..bc55000cac 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -427,7 +427,9 @@ class Exif { if ( isset( $this->mFilteredExifData['ComponentsConfiguration'] ) ) { $val = $this->mFilteredExifData['ComponentsConfiguration']; $ccVals = array(); - for ( $i = 0; $i < strlen( $val ); $i++ ) { + + $strLen = strlen( $val ); + for ( $i = 0; $i < $strLen; $i++ ) { $ccVals[$i] = ord( substr( $val, $i, 1 ) ); } $ccVals['_type'] = 'ol'; //this is for formatting later. @@ -444,7 +446,9 @@ class Exif { if ( isset( $this->mFilteredExifData['GPSVersion'] ) ) { $val = $this->mFilteredExifData['GPSVersion']; $newVal = ''; - for ( $i = 0; $i < strlen( $val ); $i++ ) { + + $strLen = strlen( $val ); + for ( $i = 0; $i < $strLen; $i++ ) { if ( $i !== 0 ) { $newVal .= '.'; } diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index 4b228b4f18..ee0233ecfa 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -84,7 +84,8 @@ class IPTC { $titles = array(); } - for ( $i = 0; $i < count( $titles ); $i++ ) { + $titleCount = count( $titles ); + for ( $i = 0; $i < $titleCount; $i++ ) { if ( isset( $bylines[$i] ) ) { // theoretically this should always be set // but doesn't hurt to be careful. -- 2.20.1