From: Brion Vibber Date: Wed, 6 Jul 2011 18:47:35 +0000 (+0000) Subject: Partial revert of r91106: followup to r91127. X-Git-Tag: 1.31.0-rc.0~29032 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=0572c46e6df452f478303db1a4fb4b099d3c30a3;p=lhc%2Fweb%2Fwiklou.git Partial revert of r91106: followup to r91127. 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. --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 367be737d0..edf8b88772 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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; -} diff --git a/includes/media/ExifBitmap.php b/includes/media/ExifBitmap.php index 2f981b3b7f..e58ac5cb89 100644 --- a/includes/media/ExifBitmap.php +++ b/includes/media/ExifBitmap.php @@ -110,7 +110,7 @@ class ExifBitmapHandler extends BitmapHandler { return false; } - $exif = wfUnserialize( $metadata ); + $exif = unserialize( $metadata ); if ( !$exif ) { return false; } diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php index 383035611a..7833e43a3c 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php @@ -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! */ }