mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 00:05:00 +00:00
Throw an exception if LuaSandboxFunction::call returns false
If LuaSandboxFunction::call returns false, it's an error on PHP's part. Throw a "real" exception so that we can see what's causing it in server logs. Bug: 71045 Change-Id: I7185e186d3e0af6e467b73ea1ef13417ca96b088
This commit is contained in:
parent
011610e770
commit
9270d30c50
|
@ -276,7 +276,15 @@ class Scribunto_LuaSandboxInterpreter extends Scribunto_LuaInterpreter {
|
|||
$args = func_get_args();
|
||||
$func = array_shift( $args );
|
||||
try {
|
||||
return call_user_func_array( array( $func, 'call' ), $args );
|
||||
$ret = call_user_func_array( array( $func, 'call' ), $args );
|
||||
if ( $ret === false ) {
|
||||
// Per the documentation on LuaSandboxFunction::call, a return value
|
||||
// of false means that something went wrong and it's PHP's fault,
|
||||
// so throw a "real" exception.
|
||||
throw new MWException(
|
||||
__METHOD__ . ': LuaSandboxFunction::call returned false' );
|
||||
}
|
||||
return $ret;
|
||||
} catch ( LuaSandboxTimeoutError $e ) {
|
||||
throw $this->engine->newException( 'scribunto-common-timeout' );
|
||||
} catch ( LuaSandboxError $e ) {
|
||||
|
|
Loading…
Reference in a new issue