Fix PHP warnings "preg_replace(): [...] invalid range in character class"
[lhc/web/wiklou.git] / includes / media / FormatMetadata.php
index 2a8b375..9ebc63f 100644 (file)
@@ -787,7 +787,7 @@ class FormatMetadata extends ContextSource {
                                                        }
                                                }
                                                if ( is_numeric( $val ) ) {
-                                                       $fNumber = pow( 2, $val / 2 );
+                                                       $fNumber = 2 ** ( $val / 2 );
                                                        if ( $fNumber !== false ) {
                                                                $val = $this->msg( 'exif-maxaperturevalue-value',
                                                                        $this->formatNum( $val ),
@@ -1859,9 +1859,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 = '_';