Merge "Correct recent schema changes for MSSQL, Oracle"
[lhc/web/wiklou.git] / includes / media / FormatMetadata.php
index 52d7373..f647a9d 100644 (file)
@@ -271,7 +271,7 @@ class FormatMetadata extends ContextSource {
                                        // TODO: YCbCrCoefficients  #p27 (see annex E)
                                        case 'ExifVersion':
                                        case 'FlashpixVersion':
-                                               $val = "$val" / 100;
+                                               $val = (int)$val / 100;
                                                break;
 
                                        case 'ColorSpace':
@@ -971,11 +971,7 @@ class FormatMetadata extends ContextSource {
 
                                        case 'LanguageCode':
                                                $lang = Language::fetchLanguageName( strtolower( $val ), $this->getLanguage()->getCode() );
-                                               if ( $lang ) {
-                                                       $val = htmlspecialchars( $lang );
-                                               } else {
-                                                       $val = htmlspecialchars( $val );
-                                               }
+                                               $val = htmlspecialchars( $lang ?: $val );
                                                break;
 
                                        default:
@@ -1859,9 +1855,9 @@ class FormatMetadata extends ContextSource {
                // 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 = '_';