// TODO: YCbCrCoefficients #p27 (see annex E)
case 'ExifVersion':
case 'FlashpixVersion':
- $val = "$val" / 100;
+ $val = (int)$val / 100;
break;
case 'ColorSpace':
if ( !is_array( $vals ) ) {
return $vals; // do nothing if not an array;
- } elseif ( count( $vals ) === 1 && $type !== 'lang' ) {
+ } elseif ( count( $vals ) === 1 && $type !== 'lang' && isset( $vals[0] ) ) {
return $vals[0];
} elseif ( count( $vals ) === 0 ) {
wfDebug( __METHOD__ . " metadata array with 0 elements!\n" );
// drop all characters which are not valid in an XML tag name
// a bunch of non-ASCII letters would be valid but probably won't
// be used so we take the easy way
- $key = preg_replace( '/[^a-zA-z0-9_:.-]/', '', $key );
+ $key = preg_replace( '/[^a-zA-z0-9_:.\-]/', '', $key );
// drop characters which are invalid at the first position
- $key = preg_replace( '/^[\d-.]+/', '', $key );
+ $key = preg_replace( '/^[\d\-.]+/', '', $key );
if ( $key == '' ) {
$key = '_';