X7ROOT File Manager
Current Path:
/opt/alt/tests/alt-php82-pecl-luasandbox_4.1.2-2.el8/tests
opt
/
alt
/
tests
/
alt-php82-pecl-luasandbox_4.1.2-2.el8
/
tests
/
ðŸ“
..
📄
LuaSandboxFunction_construct.phpt
(253 B)
📄
array-key-conversion.phpt
(3.11 KB)
📄
call.phpt
(5.1 KB)
📄
callback_exception.phpt
(392 B)
📄
datatypes-unsupported.phpt
(2.78 KB)
📄
datatypes.phpt
(2.43 KB)
📄
dump_loadBinary_call.phpt
(393 B)
📄
errors-at-call-boundaries.phpt
(1.98 KB)
📄
extending-LuaSandbox.phpt
(845 B)
📄
ipairs.phpt
(1.53 KB)
📄
loadString.phpt
(334 B)
📄
lua_catches_php_exception.phpt
(1.34 KB)
📄
pairs.phpt
(3.31 KB)
📄
pcall.phpt
(1.27 KB)
📄
profiler-sorting.phpt
(1.18 KB)
📄
profiler.phpt
(1.54 KB)
📄
reentrant.phpt
(1.1 KB)
📄
xpcall.phpt
(2.6 KB)
Editing: errors-at-call-boundaries.phpt
--TEST-- Errors at PHP→Lua call boundaries --FILE-- <?php $sandbox = null; // Will be filled in later function doTest( $str, callable $c ) { global $sandbox; echo "$str: "; $sandbox = new LuaSandbox; $sandbox->setMemoryLimit( 100000 ); try { $ret = $sandbox->loadString( 'local f = ...; return f()' ) ->call( $sandbox->wrapPhpFunction( $c ) ); var_dump( $ret ); } catch ( Exception $ex ) { echo "Exception: " . $ex->getMessage() . "\n"; } } doTest( 'LuaSandbox::callFunction', function () { global $sandbox; $sandbox->loadString( 'function foo() return "no error" end' )->call(); return $sandbox->callFunction( 'foo', str_repeat( 'a', 33334 ), str_repeat( 'b', 33334 ), str_repeat( 'c', 33334 ), str_repeat( 'd', 33334 ) ); } ); doTest( 'LuaSandbox::registerLibrary 1', function () { global $sandbox; $sandbox->registerLibrary( str_repeat( 'a', 33334 ), [ 'foo' => function () {} ] ); $sandbox->registerLibrary( str_repeat( 'b', 33334 ), [ 'foo' => function () {} ] ); $sandbox->registerLibrary( str_repeat( 'c', 33334 ), [ 'foo' => function () {} ] ); $sandbox->registerLibrary( str_repeat( 'd', 33334 ), [ 'foo' => function () {} ] ); return [ 'no error' ]; } ); doTest( 'LuaSandbox::registerLibrary 2', function () { global $sandbox; $sandbox->registerLibrary( 'foo', [ str_repeat( 'a', 33334 ) => function () {}, str_repeat( 'b', 33334 ) => function () {}, str_repeat( 'c', 33334 ) => function () {}, str_repeat( 'd', 33334 ) => function () {}, ] ); return [ 'no error' ]; } ); doTest( 'LuaSandboxFunction::call', function () { global $sandbox; return $sandbox->loadString( 'return "no error"' )->call( str_repeat( 'a', 33334 ), str_repeat( 'b', 33334 ), str_repeat( 'c', 33334 ), str_repeat( 'd', 33334 ) ); } ); --EXPECT-- LuaSandbox::callFunction: Exception: not enough memory LuaSandbox::registerLibrary 1: Exception: not enough memory LuaSandbox::registerLibrary 2: Exception: not enough memory LuaSandboxFunction::call: Exception: not enough memory
Upload File
Create Folder