r91581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91580‎ | r91581 | r91582 >
Date:18:47, 6 July 2011
Author:brion
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/media/ExifBitmap.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/GlobalFunctions/GlobalTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/GlobalFunctions/GlobalTest.php
@@ -878,12 +878,6 @@
879879 // are less consistent.
880880 );
881881 }
882 -
883 - public function testUnserialize() {
884 - $this->assertEquals( '', wfUnserialize( 's:0:"";') );
885 - $this->assertEquals( false, wfUnserialize( '0' ),
886 - 'Invalid input to unserialize()' );
887 - }
888882
889883 /* TODO: many more! */
890884 }
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -3540,17 +3540,3 @@
35413541 function wfRunHooks( $event, $args = array() ) {
35423542 return Hooks::run( $event, $args );
35433543 }
3544 -
3545 -/**
3546 - * Unserialize a string to a PHP value without throwing E_NOTICE. Simply a
3547 - * wrapper around unserialize()
3548 - *
3549 - * @param $data string The serialized string
3550 - * @return mixed
3551 - */
3552 -function wfUnserialize( $data ) {
3553 - wfSuppressWarnings();
3554 - $result = unserialize( $data );
3555 - wfRestoreWarnings();
3556 - return $result;
3557 -}
Index: trunk/phase3/includes/media/ExifBitmap.php
@@ -110,7 +110,7 @@
111111 return false;
112112 }
113113
114 - $exif = wfUnserialize( $metadata );
 114+ $exif = unserialize( $metadata );
115115 if ( !$exif ) {
116116 return false;
117117 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91106Add wfUnserialize() wrapper around unserialize to prevent E_NOTICE and use it...btongminh20:24, 29 June 2011
r91127(follow-up r91106) Explicitly compare against the self::BROKEN_FILE constants....bawolff22:24, 29 June 2011

Status & tagging log