What makes __destruct called twice in such a simple PHP code?

ぐ巨炮叔叔 提交于 2019-12-02 01:16:56

Finally I find the reason.

It might be a bug in PHP 5.2.x :

If

zend.ze1_compatibility_mode = On 

then you can see "__destruct" twice when execute the code I provide in my question.

This issue has been reported in other versions : https://bugs.php.net/bug.php?id=29756

Not affect PHP 5.3 in my test. (PHP 5.3 removed this setting)

Hope this answer will be helpful for some guys later :)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!