3 Commits

Author SHA1 Message Date
Xinchen Hui
1ff1eb10c9 releaseing 2.0.3 2017-02-10 19:13:44 +08:00
Xinchen Hui
cbe65b9ad6 Fixed issue #20 (PHP 7: Lua::eval(): unsupported type `unknown' for lua) 2016-05-30 11:44:12 +08:00
Xinchen Hui
04f7106631 back to dev 2016-05-26 17:42:59 +08:00
3 changed files with 33 additions and 8 deletions

12
lua.c
View File

@@ -351,7 +351,7 @@ zval *php_lua_get_zval_from_lua(lua_State *L, int index, zval *lua_obj, zval *rv
break; break;
} }
switch(Z_TYPE(key)) { switch (Z_TYPE(key)) {
case IS_DOUBLE: case IS_DOUBLE:
case IS_LONG: case IS_LONG:
add_index_zval(rv, Z_DVAL(key), &val); add_index_zval(rv, Z_DVAL(key), &val);
@@ -401,6 +401,7 @@ zval *php_lua_get_zval_from_lua(lua_State *L, int index, zval *lua_obj, zval *rv
int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ { int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
try_again:
switch (Z_TYPE_P(val)) { switch (Z_TYPE_P(val)) {
case IS_TRUE: case IS_TRUE:
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
@@ -408,6 +409,7 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
case IS_FALSE: case IS_FALSE:
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
break; break;
case IS_UNDEF:
case IS_NULL: case IS_NULL:
lua_pushnil(L); lua_pushnil(L);
break; break;
@@ -472,6 +474,14 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
} }
} }
break; break;
case IS_REFERENCE:
ZVAL_DEREF(val);
goto try_again;
break;
case IS_INDIRECT:
val = Z_INDIRECT_P(val);
goto try_again;
break;
default: default:
php_error_docref(NULL, E_ERROR, "unsupported type `%s' for lua", zend_zval_type_name(val)); php_error_docref(NULL, E_ERROR, "unsupported type `%s' for lua", zend_zval_type_name(val));
lua_pushnil(L); lua_pushnil(L);

View File

@@ -23,11 +23,11 @@
<email>msaraujo@php.net</email> <email>msaraujo@php.net</email>
<active>yes</active> <active>yes</active>
</developer> </developer>
<date>2016-05-26</date> <date>2017-02-10</date>
<time>10:50:27</time> <time>19:15:00</time>
<version> <version>
<release>2.0.2</release> <release>2.0.3</release>
<api>2.0.2</api> <api>2.0.3</api>
</version> </version>
<stability> <stability>
<release>stable</release> <release>stable</release>
@@ -35,7 +35,7 @@
</stability> </stability>
<license uri="http://www.php.net/license">PHP</license> <license uri="http://www.php.net/license">PHP</license>
<notes> <notes>
- Fixed issue #22 (Boolean FALSE is always TRUE) - Fixed issue #20 (PHP 7: Lua::eval(): unsupported type `unknown' for lua)
</notes> </notes>
<contents> <contents>
<dir name="/"> <dir name="/">
@@ -81,6 +81,22 @@
<providesextension>lua</providesextension> <providesextension>lua</providesextension>
<extsrcrelease /> <extsrcrelease />
<changelog> <changelog>
<release>
<date>2017-02-10</date>
<version>
<release>2.0.3</release>
<api>2.0.3</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- Fixed issue #20 (PHP 7: Lua::eval(): unsupported type `unknown' for lua)
</notes>
</release>
<release> <release>
<date>2016-05-26</date> <date>2016-05-26</date>
<version> <version>
@@ -96,7 +112,6 @@
- Fixed issue #22 (Boolean FALSE is always TRUE) - Fixed issue #22 (Boolean FALSE is always TRUE)
</notes> </notes>
</release> </release>
<release> <release>
<date>2016-04-11</date> <date>2016-04-11</date>
<version> <version>

View File

@@ -48,7 +48,7 @@ extern zend_module_entry lua_module_entry;
#define LUA_G(v) (lua_globals.v) #define LUA_G(v) (lua_globals.v)
#endif #endif
#define PHP_LUA_VERSION "2.0.2" #define PHP_LUA_VERSION "2.0.3"
struct _php_lua_object { struct _php_lua_object {
lua_State *L; lua_State *L;