fixed error reporting in evaluation of function returns
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Mar 2006 09:23:18 +0000 (09:23 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Mar 2006 09:23:18 +0000 (09:23 +0000)
includes/cbt/CBTProcessor.php

index 8fc7006..6afae32 100644 (file)
@@ -114,8 +114,13 @@ class CBTValue {
                        $myProcessor = new CBTProcessor( $this->mText,  $processor->mFunctionObj, $processor->mIgnorableDeps );
                        $myProcessor->mCompiling = $processor->mCompiling;
                        $val = $myProcessor->doText( 0, strlen( $this->mText ) );
-                       $this->mText = $val->mText;
-                       $this->addDeps( $val );
+                       if ( $myProcessor->getLastError() ) {
+                               $processor->error( $myProcessor->getLastError() );
+                               $this->mText = '';
+                       } else {
+                               $this->mText = $val->mText;
+                               $this->addDeps( $val );
+                       }
                        if ( !$processor->mCompiling ) {
                                $this->mIsTemplate = false;
                        }
@@ -144,6 +149,8 @@ class CBTProcessor {
                $mCompiling = false,        # True if compiling to a template, false if executing to text
                $mIgnorableDeps = array(),  # Dependency names which should be treated as static
                $mFunctionCache = array(),  # A cache of function results keyed by argument hash
+               $mLastError = false,        # Last error message or false for no error
+               $mErrorPos = 0,             # Last error position
 
                /** Built-in functions */
                $mBuiltins = array(