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.
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;
-}
return false;
}
- $exif = wfUnserialize( $metadata );
+ $exif = unserialize( $metadata );
if ( !$exif ) {
return false;
}
// are less consistent.
);
}
-
- public function testUnserialize() {
- $this->assertEquals( '', wfUnserialize( 's:0:"";') );
- $this->assertEquals( false, wfUnserialize( '0' ),
- 'Invalid input to unserialize()' );
- }
/* TODO: many more! */
}