if ( $handler ) {
$metadata = $this->getMetadata();
- if ( $metadata ) {
- if ( is_string( $metadata ) ) {
- $metadata = MediaWiki\quietCall( 'unserialize', $metadata );
- }
+ if ( is_string( $metadata ) ) {
+ $metadata = MediaWiki\quietCall( 'unserialize', $metadata );
+ }
- return $handler->getContentHeaders( $metadata, $this->getWidth(), $this->getHeight() );
+ if ( !is_array( $metadata ) ) {
+ $metadata = [];
}
+
+ return $handler->getContentHeaders( $metadata, $this->getWidth(), $this->getHeight() );
}
return [];
if ( $handler ) {
$metadata = MediaWiki\quietCall( 'unserialize', $props['metadata'] );
+ if ( !is_array( $metadata ) ) {
+ $metadata = [];
+ }
+
$options['headers'] = $handler->getContentHeaders(
$metadata, $props['width'], $props['height']
);
* @since 1.30
*/
public function getContentHeaders( $metadata, $fallbackWidth = null, $fallbackHeight = null ) {
- if ( !is_array( $metadata ) || !isset( $metadata['xml'] ) ) {
+ if ( !isset( $metadata['xml'] ) ) {
return [];
}