r99064 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99063‎ | r99064 | r99065 >
Date:00:31, 6 October 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Commit live debugging hack
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/OpenSearchXml/ApiOpenSearchXml.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/OpenSearchXml/ApiOpenSearchXml.php
@@ -77,7 +77,11 @@
7878
7979 $srchres = PrefixSearch::titleSearch( $search, $limit, $namespaces );
8080
81 - $items = array_filter( array_map( array( $this, 'formatItem' ), $srchres ) );
 81+ try {
 82+ $items = array_filter( array_map( array( $this, 'formatItem' ), $srchres ) );
 83+ } catch (Exception $e) {
 84+ wfDebugLog( 'bug27452', "exception in " . __METHOD__ . "'s array_map(): " . get_class($e) . ": " . $e->getMessage() );
 85+ }
8286
8387 $result = $this->getResult();
8488 $result->addValue( null, 'version', '2.0' );
@@ -125,11 +129,15 @@
126130 $item['Url']['*'] = wfExpandUrl( $title->getFullUrl(), PROTO_CURRENT );
127131 if( $image ) {
128132 $thumb = $image->transform( array( 'width' => 50, 'height' => 50 ), 0 );
129 - $item['Image'] = array(
130 - 'source' => wfExpandUrl( $thumb->getUrl(), PROTO_CURRENT ),
131 - //alt
132 - 'width' => $thumb->getWidth(),
133 - 'height' => $thumb->getHeight() );
 133+ if( $thumb ) {
 134+ $item['Image'] = array(
 135+ 'source' => wfExpandUrl( $thumb->getUrl(), PROTO_CURRENT ),
 136+ //alt
 137+ 'width' => $thumb->getWidth(),
 138+ 'height' => $thumb->getHeight() );
 139+ } else {
 140+ wfDebugLog( 'bug27452', "empty \$thumb, would have fataled us" );
 141+ }
134142 }
135143 } else {
136144 $item = array( 'Text' => array( '*' => $name ) );

Comments

#Comment by Reedy (talk | contribs)   00:32, 6 October 2011
#Comment by Tim Starling (talk | contribs)   02:40, 12 December 2011

That's a dead link. I'm not sure if this needs reapplication in 1.19wmf1, tagging reapply just in case. Please remove if not.

#Comment by Reedy (talk | contribs)   13:57, 12 December 2011

Per the code this is bug 27452. I don't think there is much point reappling it, it never managed to log anything. The bit of extra safeguarding on the $thumb object made it upstream, so the rest is a live debugging hack.

Logged as an upstream PHP bug

Status & tagging log