You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use php-lua with a custom package loader loading lua scripts and modules from a remote server. I ran into an issue with assert and error inside my modules. When an assert throws or when I call the Lua error function, php-lua raises an exception:
call to lua function (null) failed
#0 [internal function]: LuaClosure->__invoke()
#1 [internal function]: LuaClosure->__invoke()
#2 /path/to/bug-assert.php(34): Lua->eval('local m = requi...')
#3 {main}
I attached a test case showing this problem. The test case installs a custom package loader load_package which tells Lua to call the PHP run_script function (which in my real application fetches code from a remote server) when a module is required. run_script loads a module which exposes a single function func containing asserts. When the main script calls func any assert that doesn't pass will throw a LuaClosure exception. Same for when the function calls error. If I move the assert to the module's main context, it works as expected.
I tested the 1.1.0 release from PECL and the master branch on GitHub.
I am trying to use php-lua with a custom package loader loading lua scripts and modules from a remote server. I ran into an issue with
assert
anderror
inside my modules. When anassert
throws or when I call the Luaerror
function, php-lua raises an exception:I attached a test case showing this problem. The test case installs a custom package loader
load_package
which tells Lua to call the PHPrun_script
function (which in my real application fetches code from a remote server) when a module isrequire
d.run_script
loads a module which exposes a single functionfunc
containingassert
s. When the main script callsfunc
anyassert
that doesn't pass will throw a LuaClosure exception. Same for when the function callserror
. If I move the assert to the module's main context, it works as expected.I tested the 1.1.0 release from PECL and the master branch on GitHub.
bug-assert.phpt
The text was updated successfully, but these errors were encountered: