X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fmedia%2FFormatMetadata.php;h=9ebc63f678fdef9fcbc38b16c952553e536461a8;hb=d88e924b6e5a7d529c471980e14f72430a94e546;hp=b008a226884b3e2c4f58bc2e6c7efa43229883a2;hpb=2ef178072f6f46abde7bdcc2630389a8b2837557;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index b008a22688..9ebc63f678 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -20,7 +20,7 @@ * @ingroup Media * @author Ævar Arnfjörð Bjarmason * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason, 2009 Brent Garber, 2010 Brian Wolff - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License + * @license GPL-2.0-or-later * @see http://exif.org/Exif2-2.PDF The Exif 2.2 specification * @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 ), @@ -1047,7 +1047,7 @@ class FormatMetadata extends ContextSource { 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" ); @@ -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 = '_';