Class destructor is not called automatically #47

已关闭
belliash2019-03-18 12:56:02 +01:00创建 · 7 评论
管理员

AerScript Information

  • Aer Version (or commit ref): d4992ff4ba
  • Operating System: Linux
  • System Architecture (eg. arm, x86_64, ...): x86_64

Your problem description

Class destructor is not called automatically, see example code:

<?php
class X {
    function __construct() {
            echo 'Constructor';
    }
    function __destruct() {
            echo 'Destructor';
    }
}
$x = new X();
?>

Above code gives the same result in PH7. This bug is derived from upstream project.

Expected results

'ConstructorDestructor' should appear.

Current results

'Constructor' appears only, what means that destructor is not called.

<!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please take a moment to check that your issue doesn't already exist. 3. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> # AerScript Information - Aer Version (or commit ref): d4992ff4ba - Operating System: Linux - System Architecture (eg. arm, x86_64, ...): x86_64 # Your problem description Class destructor is not called automatically, see example code: <?php class X { function __construct() { echo 'Constructor'; } function __destruct() { echo 'Destructor'; } } $x = new X(); ?> Above code gives the same result in PH7. This bug is derived from upstream project. # Expected results 'ConstructorDestructor' should appear. # Current results 'Constructor' appears only, what means that destructor is not called.
belliash2019-03-18 12:56:02 +01:00 添加了标签
bug
作者
管理员

Additionally, we have broken the unset() function, as it is calling the __destruct() method in PH7.

Additionally, we have broken the unset() function, as it is calling the __destruct() method in PH7.
作者
管理员

unset() builtin function seems broken partially since bd4d146d0a. Looks like it was never working for variables defined with a specified data type. If no data type is specified then unset() is still working.

Seems, there is some difference between:

$x = new Obj();

and

object $x = new Obj();
unset() builtin function seems broken partially since bd4d146d0a. Looks like it was never working for variables defined with a specified data type. If no data type is specified then unset() is still working. Seems, there is some difference between: $x = new Obj(); and object $x = new Obj();
作者
管理员
object $x;
$x = new Obj();

Above version is not affected.

object $x; $x = new Obj(); Above version is not affected.
作者
管理员

This is related to missed OP_POP call when assigning a value during variable declaration.

This is related to missed OP_POP call when assigning a value during variable declaration.
belliash2019-03-19 10:42:58 +01:00 在代码提交中引用了该工单
作者
管理员

Fixed everything, what got broken within 'typehinting' branch.
Static variables (both in methods/closure and class attributes) were never destroyed properly in PH7. Fixing this bug will lead to:

  • fixing a garbage collector and freeing more memory,
  • automatically calling a destructor if available (when static variable was an object)
Fixed everything, what got broken within 'typehinting' branch. Static variables (both in methods/closure and class attributes) were never destroyed properly in PH7. Fixing this bug will lead to: * fixing a garbage collector and freeing more memory, * automatically calling a destructor if available (when static variable was an object)
作者
管理员

Segmentation fault fixed in 407bcf5a29.

Segmentation fault fixed in 407bcf5a29.
作者
管理员

Fixed in 171456beb4.
Test extended in 4afcbc0815 confirms, it is working.

Fixed in 171456beb4. Test extended in 4afcbc0815 confirms, it is working.
belliash2019-06-29 16:09:27 +02:00 关闭此工单
belliash2019-06-29 16:09:32 +02:00 指派给自己
登录 并参与到对话中。
未选择里程碑
未指派成员
1 名参与者
通知
到期时间
到期日期无效或超出范围。请使用 'yyyy-mm-dd' 格式。

未设置到期时间。

依赖工单

没有设置依赖项。

参考:aerscript/Aer#47
没有提供说明。