Bug #80670 [NEW]: error call exit in construct not run destruct
| From: | icarosnet at gmail dot com | Date: | Mon, 25 Jan 2021 21:26:26 +0000 |
| Subject: | Bug #80670 [NEW]: error call exit in construct not run destruct | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231769@lists.php.net to get a copy of this message | ||
From: icarosnet at gmail dot com
Operating system: all
PHP version: 8.0Git-2021-01-25 (Git)
Package: Class/Object related
Bug Type: Bug
Bug description:error call exit in construct not run destruct
Description:
------------
after few test; i try to migrate from php 7.4 to 8 and get that i think
is a bug or you not documented it:
in php 7.4 when i run the constructor and inside it i run a exit(), the
destructor will triggered.
in php 8.0 not; check this link example:
Work in php 7.4.13
http://sandbox.onlinephpfunctions.com/code/38f312d12f72cba32c3cd1819a047504b0d62f6c
not work in php 8.0
http://sandbox.onlinephpfunctions.com/code/38f312d12f72cba32c3cd1819a047504b0d62f6c
Test script:
---------------
<?php
//run in php 7.4.13 and php 8.0 you would see the diference.
class Test{
function __construct(){
echo '<div>Star Construct</div><br>';
if(true){
exit();
}
}
function __destruct(){
echo '<div>Run Destruct</div><br>';
}
}
$t = new Test();
--
Edit bug report at https://bugs.php.net/bug.php?id=80670&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80670&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80670&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80670&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80670&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80670&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80670&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80670&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80670&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80670&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80670&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80670&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80670&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80670&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80670&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80670&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80670&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80670&r=mysqlcfg