Page MenuHomePhabricator

SmoothGallery: Call to a member function getText() on a non-object
Closed, ResolvedPublic

Description

(Note: SmoothGallery is not in the bugzilla component list)

When calling SmoothGallery 1.1e under MediaWiki 1.16alpha (r51492), it works when both filenames and descriptions are present:

{{#sgallery: imagelist=File:Aconitum-napellus 4435.jpg{{!}}''Aconitum napellus'', Infloreszenz
File:Aconitum_napellus2_ies.jpg{{!}}''Aconitum napellus'', from side
File:Aconitum_napellus3_ies.jpg{{!}}''Aconitum napellus'', inside
File:Aconitum_napellus8_ies.jpg{{!}}''Aconitum napellus'', leaves
}}

but when leaving away the description:

{{#sgallery: imagelist=File:Aconitum-napellus 4435.jpg
File:Aconitum_napellus2_ies.jpg
File:Aconitum_napellus3_ies.jpg
File:Aconitum_napellus8_ies.jpg
}}

the page is no longer rendered at all, and the error message:

Fatal error: Call to a member function getText() on a non-object in ...mediawiki/extensions/SmoothGallery/SmoothGalleryParser.php on line 247

is shown.

On http://www.ryandlane.com/sandbox/SmoothGallery is works ok under 1.15.0rc1 (r51439), so the bug seems to be 1.16-specific.


Version: unspecified
Severity: critical

Details

Reference
bz19148

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:39 PM
bzimport set Reference to bz19148.
bzimport added a subscriber: Unknown Object (MLST).

Update: The error is probably not related to 1.16, but to using a shared repository.

If no image description is provided, ''and'' the image comes from a shared repository that uses API connection (such as using images from Wikimedia Commons), then the following code in SmoothGalleryParser fails with a fatal error:

if ( $description == '' ) {

// Load the image page from the database with the provided title from the image object
$db = wfGetDB( DB_SLAVE );
$img_rev = Revision::loadFromTitle( $db, $title );
// Get the text from the image page's description
$description = $img_rev->getText();

}