mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-14 19:30:57 +00:00
441943bd9b
Optionally remove setfenv and getfenv from the global environment in which user code runs. This will improve the forwards-compatibility of user code with Lua 5.2. Porting to Lua 5.2 would still be a daunting project, of questionable value, but at least only the internal code would need updating, and not thousands of on-wiki modules. Compared to the environment changes, the rest of the Lua 5.2 changes are relatively easy to simulate for backwards compatibility. Removed module() from the package module, since it depends on setfenv(). The native version of it is deprecated in Lua 5.2 for that reason. Change-Id: I978903ca98943ac941833da13fe5027949f6b429
25 lines
569 B
PHP
25 lines
569 B
PHP
<?php
|
|
|
|
if ( php_sapi_name() !== 'cli' ) exit;
|
|
require_once( dirname( __FILE__ ) .'/../LuaCommon/LuaEngineTest.php' );
|
|
|
|
class Scribunto_LuaSandboxEngineTest extends Scribunto_LuaEngineTest {
|
|
var $stdOpts = array(
|
|
'memoryLimit' => 50000000,
|
|
'cpuLimit' => 30,
|
|
'allowEnvFuncs' => true,
|
|
);
|
|
|
|
function newEngine( $opts = array() ) {
|
|
$opts = $opts + $this->stdOpts;
|
|
return new Scribunto_LuaSandboxEngine( $opts );
|
|
}
|
|
|
|
function getTestModules() {
|
|
return parent::getTestModules() + array(
|
|
'SandboxTests' => dirname( __FILE__ ) . '/SandboxTests.lua'
|
|
);
|
|
}
|
|
}
|
|
|