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

后端 未结 1 1416
眼角桃花
眼角桃花 2021-01-23 02:45


        
相关标签:
1条回答
  • 2021-01-23 03:14

    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 :)

    0 讨论(0)
提交回复
热议问题