(bug 15563) port PHP bug workaround to Parser_OldPP
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 6 Oct 2008 08:21:41 +0000 (08:21 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 6 Oct 2008 08:21:41 +0000 (08:21 +0000)
includes/parser/Parser_OldPP.php

index 106e439..177b989 100644 (file)
@@ -578,6 +578,10 @@ class Parser_OldPP
                                        break;
                                default:
                                        if( isset( $this->mTagHooks[$tagName] ) ) {
+                                               # Workaround for PHP bug 35229 and similar
+                                               if ( !is_callable( $this->mTagHooks[$tagName] ) ) {
+                                                       throw new MWException( "Tag hook for $tagName is not callable\n" );
+                                               }
                                                $output = call_user_func_array( $this->mTagHooks[$tagName],
                                                        array( $content, $params, $this ) );
                                        } else {
@@ -3013,6 +3017,11 @@ class Parser_OldPP
                                if ( $function ) {
                                        $funcArgs = array_map( 'trim', $args );
                                        $funcArgs = array_merge( array( &$this, trim( substr( $part1, $colonPos + 1 ) ) ), $funcArgs );
+
+                                       # Workaround for PHP bug 35229 and similar
+                                       if ( !is_callable( $this->mFunctionHooks[$function] ) ) {
+                                               throw new MWException( "Function hook for $function is not callable\n" );
+                                       }
                                        $result = call_user_func_array( $this->mFunctionHooks[$function], $funcArgs );
                                        $found = true;