diff --git a/lua.c b/lua.c
index 8809f4d..d5f4acd 100755
--- a/lua.c
+++ b/lua.c
@@ -174,6 +174,11 @@ static void php_lua_dtor_object(zend_object *object) /* {{{ */ {
php_lua_object *lua_obj = php_lua_obj_from_obj(object);
zend_object_std_dtor(&(lua_obj->obj));
+}
+/* }}} */
+
+static void php_lua_free_object(zend_object *object) /* {{{ */ {
+ php_lua_object *lua_obj = php_lua_obj_from_obj(object);
if (lua_obj->L) {
lua_close(lua_obj->L);
@@ -831,7 +836,7 @@ PHP_MINIT_FUNCTION(lua) {
memcpy(&lua_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
lua_object_handlers.offset = XtOffsetOf(php_lua_object, obj);
lua_object_handlers.dtor_obj = php_lua_dtor_object;
- lua_object_handlers.free_obj = NULL;
+ lua_object_handlers.free_obj = php_lua_free_object;
lua_object_handlers.clone_obj = NULL;
lua_object_handlers.write_property = php_lua_write_property;
lua_object_handlers.read_property = php_lua_read_property;
diff --git a/package.xml b/package.xml
index 6378aae..d32a969 100644
--- a/package.xml
+++ b/package.xml
@@ -35,7 +35,7 @@
PHP
- - Fixed issue #20 (PHP 7: Lua::eval(): unsupported type `unknown' for lua)
+ - Fixed bug #73964 (Segmentation fault)
@@ -65,6 +65,7 @@
+
diff --git a/tests/bug73964.phpt b/tests/bug73964.phpt
new file mode 100644
index 0000000..de03c54
--- /dev/null
+++ b/tests/bug73964.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #73964 (Segmentation fault (11))
+--SKIPIF--
+
+--FILE--
+lua = new Lua();
+ $this->lua->registerCallback("log", array($this, "API_LuaLog"));
+ }
+
+
+ function API_LuaLog( $entry)
+ {
+ echo("from lua: $entry");
+ }
+
+ public function RunTest()
+ {
+ $this->lua->eval(<<lua->RootTable;
+
+ $this->lua->call("TestFunc", array("okey"));
+ }
+}
+
+
+$a = new LuaTest();
+$a->runtest();
+?>
+--EXPECT--
+from lua: okey