#46152 [Bgs]: Exit() don't stop execute
| From: | paszczak at thecamels dot org | Date: | Mon, 22 Sep 2008 21:30:49 +0000 |
| Subject: | #46152 [Bgs]: Exit() don't stop execute | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129194@lists.php.net to get a copy of this message | ||
ID: 46152
User updated by: paszczak at thecamels dot org
Reported By: paszczak at thecamels dot org
Status: Bogus
Bug Type: *General Issues
PHP Version: 5.2.6
New Comment:
Maybe its not a bug. But if I want to terminate the current script
(immediately), which function should I use?
http://pl2.php.net/manual/pl/function.exit.php
exit — Output a message and terminate the current script
I thought that die() are called destructors after request finishes and
are meant to handle, but exit() terminate the current script
immediately.
Previous Comments:
------------------------------------------------------------------------
[2008-09-22 14:13:46] tularis@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Destructors are called after request finishes and are meant to handle
any cleanup required (ie. closing database connections). This is
intended behaviour.
------------------------------------------------------------------------
[2008-09-22 12:55:02] paszczak at thecamels dot org
Description:
------------
Why exit don't stop execute of PHP script?
Reproduce code:
---------------
class innaklasa
{
public function __construct()
{
print "inna klasa<br />";
}
public function zrob()
{
print "inna klasa zrob<br />";
}
}
class klasa
{
public function __construct()
{
print "konstruktor<br />";
}
public function __destruct()
{
print "destruktor<br />";
$innaklasa = new innaklasa;
$innaklasa->zrob();
}
}
$c = new klasa;
exit;
Expected result:
----------------
konstruktor
Actual result:
--------------
konstruktor
inna klasa
inna klasa zrob
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46152&edit=1