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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T15041, the corresponding Phabricator task for complete and up-to-date bug report information.
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