Partial revert of r91106: followup to r91127.
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Jul 2011 18:47:35 +0000 (18:47 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Jul 2011 18:47:35 +0000 (18:47 +0000)
Suppressing all warning output from unserialize() in ExifBitmap::formatMetadata will hide actual errors; we're now checking explicitly for the bad-metadata and no-metadata markers so the case this was added for should not happen.

includes/GlobalFunctions.php
includes/media/ExifBitmap.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php

index 367be73..edf8b88 100644 (file)
@@ -3540,17 +3540,3 @@ function wfGetParserCacheStorage() {
 function wfRunHooks( $event, $args = array() ) {
        return Hooks::run( $event, $args );
 }
-
-/**
- * Unserialize a string to a PHP value without throwing E_NOTICE. Simply a
- * wrapper around unserialize()
- *
- * @param $data string The serialized string
- * @return mixed
- */
-function wfUnserialize( $data ) {
-       wfSuppressWarnings();
-       $result = unserialize( $data );
-       wfRestoreWarnings();
-       return $result;
-}
index 2f981b3..e58ac5c 100644 (file)
@@ -110,7 +110,7 @@ class ExifBitmapHandler extends BitmapHandler {
                        return false;
                }
 
-               $exif = wfUnserialize( $metadata );
+               $exif = unserialize( $metadata );
                if ( !$exif ) {
                        return false;
                }
index 3830356..7833e43 100644 (file)
@@ -878,12 +878,6 @@ class GlobalTest extends MediaWikiTestCase {
                        // are less consistent.
                );
        }
-       
-       public function testUnserialize() {
-               $this->assertEquals( '', wfUnserialize( 's:0:"";') );
-               $this->assertEquals( false, wfUnserialize( '0' ),
-                       'Invalid input to unserialize()' );
-       }
 
        /* TODO: many more! */
 }