dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Guard against uncountable tag values
[lhc/web/wiklou.git]
/
includes
/
media
/
Exif.php
diff --git
a/includes/media/Exif.php
b/includes/media/Exif.php
index
cd457f0
..
70f8d5c
100644
(file)
--- a/
includes/media/Exif.php
+++ b/
includes/media/Exif.php
@@
-292,9
+292,9
@@
class Exif {
$this->debugFile( $this->basename, __FUNCTION__, true );
if ( function_exists( 'exif_read_data' ) ) {
$this->debugFile( $this->basename, __FUNCTION__, true );
if ( function_exists( 'exif_read_data' ) ) {
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
$data = exif_read_data( $this->file, 0, true );
$data = exif_read_data( $this->file, 0, true );
-
MediaWiki
\restoreWarnings();
+
Wikimedia
\restoreWarnings();
} else {
throw new MWException( "Internal error: exif_read_data not present. " .
"\$wgShowEXIF may be incorrectly set or not checked by an extension." );
} else {
throw new MWException( "Internal error: exif_read_data not present. " .
"\$wgShowEXIF may be incorrectly set or not checked by an extension." );
@@
-467,17
+467,17
@@
class Exif {
break;
}
if ( $charset ) {
break;
}
if ( $charset ) {
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
$val = iconv( $charset, 'UTF-8//IGNORE', $val );
$val = iconv( $charset, 'UTF-8//IGNORE', $val );
-
MediaWiki
\restoreWarnings();
+
Wikimedia
\restoreWarnings();
} else {
// if valid utf-8, assume that, otherwise assume windows-1252
$valCopy = $val;
UtfNormal\Validator::quickIsNFCVerify( $valCopy ); // validates $valCopy.
if ( $valCopy !== $val ) {
} else {
// if valid utf-8, assume that, otherwise assume windows-1252
$valCopy = $val;
UtfNormal\Validator::quickIsNFCVerify( $valCopy ); // validates $valCopy.
if ( $valCopy !== $val ) {
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
$val = iconv( 'Windows-1252', 'UTF-8//IGNORE', $val );
$val = iconv( 'Windows-1252', 'UTF-8//IGNORE', $val );
-
MediaWiki
\restoreWarnings();
+
Wikimedia
\restoreWarnings();
}
}
}
}
@@
-742,12
+742,16
@@
class Exif {
$ecount = 1; // checking individual elements
}
}
$ecount = 1; // checking individual elements
}
}
- $count = count( $val );
- if ( $ecount != $count ) {
- $this->debug( $val, __FUNCTION__, "Expected $ecount elements for $tag but got $count" );
- return false;
+ $count = 1;
+ if ( is_array( $val ) ) {
+ $count = count( $val );
+ if ( $ecount != $count ) {
+ $this->debug( $val, __FUNCTION__, "Expected $ecount elements for $tag but got $count" );
+ return false;
+ }
}
}
+ // If there are multiple values, recursively validate each of them.
if ( $count > 1 ) {
foreach ( $val as $v ) {
if ( !$this->validate( $section, $tag, $v, true ) ) {
if ( $count > 1 ) {
foreach ( $val as $v ) {
if ( !$this->validate( $section, $tag, $v, true ) ) {