Index: branches/wmf/1.18wmf1/extensions/OpenSearchXml/ApiOpenSearchXml.php |
— | — | @@ -77,7 +77,11 @@ |
78 | 78 | |
79 | 79 | $srchres = PrefixSearch::titleSearch( $search, $limit, $namespaces ); |
80 | 80 | |
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 | + } |
82 | 86 | |
83 | 87 | $result = $this->getResult(); |
84 | 88 | $result->addValue( null, 'version', '2.0' ); |
— | — | @@ -125,11 +129,15 @@ |
126 | 130 | $item['Url']['*'] = wfExpandUrl( $title->getFullUrl(), PROTO_CURRENT ); |
127 | 131 | if( $image ) { |
128 | 132 | $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 | + } |
134 | 142 | } |
135 | 143 | } else { |
136 | 144 | $item = array( 'Text' => array( '*' => $name ) ); |