laruence / php-lua

This extension embeds the lua interpreter and offers an OO-API to lua variables and functions.
http://pecl.php.net/package/lua
Other
149 stars 50 forks source link

PHP 7: Lua::eval(): unsupported type `unknown' for lua #20

Closed vyuldashev closed 7 years ago

laruence commented 8 years ago

is there any test script to reproduce this?

glenwong commented 8 years ago

I modified one of the phpt tests to reproduce this issue.

<?php 
$l = new lua();
class A {
    public static function intro($foo, $bar) {
        throw new InvalidArgumentException("Invalid Argument");
        echo $foo, $bar;
  }
}   

$l->registerCallback("callphp", array("A", "intro")); 
try {
$l->eval(<<<CODE
    callphp("foo", "bar");
CODE
);
} catch (Exception $e) {
    var_dump($e->getMessage());
}
?>

In php7 this blows up with:

Fatal error: Lua::eval(): unsupported type `unknown' for lua` 

In php54 the exception is caught and just prints string(16) "Invalid Argument"

I think the problem is that php_lua_send_zval_to_lua doesn't support IS_UNDEF which appears to be a new type in php7.

laruence commented 7 years ago

this should be fixed, I will make a release soon, thanks