Last modified: 2008-02-26 01:25:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 13041 - ParserFunctions function getExprParser does not return a pre-existing handle to the Expr parser if it exists
ParserFunctions function getExprParser does not return a pre-existing handle ...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-17 05:21 UTC by Ryan Dean
Modified: 2008-02-26 01:25 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to correct issue as described (462 bytes, patch)
2008-02-17 05:21 UTC, Ryan Dean
Details

Description Ryan Dean 2008-02-17 05:21:00 UTC
Created attachment 4656 [details]
Patch to correct issue as described

The code for the function getExprParser returns a handle to a new instance of ExprParser on every call, rather than a pre-existing handle if one is already set.

Here is the current code:

    function &getExprParser() {
        if ( !isset( $this->mExpr ) ) {
            if ( !class_exists( 'ExprParser' ) ) {
                require( dirname( __FILE__ ) . '/Expr.php' );
            }
            $this->mExprParser = new ExprParser;
        }
        return $this->mExprParser;
    }

The variable checked in the if statement, mExpr, is not defined as a class variable in the ExtParserFunctions class.  I believe this to be a typo / refactoring artifact, and that it should instead check to see if mExprParser is set.

    function &getExprParser() {
        if ( !isset( $this->mExprParser ) ) {
            if ( !class_exists( 'ExprParser' ) ) {
                require( dirname( __FILE__ ) . '/Expr.php' );
            }
            $this->mExprParser = new ExprParser;
        }
        return $this->mExprParser;
    }

I've attached a patch with the correction as well.
Comment 1 Brion Vibber 2008-02-26 01:25:41 UTC
Fixed in r31287

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links