ID:               36831
 Updated by:       [EMAIL PROTECTED]
 Reported By:      felho at avalon dot aut dot bme dot hu
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
-Operating System: Windows XP SP2
+Operating System: *
-PHP Version:      5.1.2
+PHP Version:      *
 New Comment:

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

Most parts of php are already shutdown when the engine calls the
destructors after the script ends. For the same reason you cannot
output anything from a destructor.


Previous Comments:
------------------------------------------------------------------------

[2006-03-23 12:24:08] felho at avalon dot aut dot bme dot hu

Description:
------------
In case when an object is freed up at the end of the script file
creation will fail in destructor. When I force this before the end of
script the file will be created.

Reproduce code:
---------------
<?php
        class foo {
                function __construct()
                {
                        fopen(date('YmdHim').'.const.txt', 'w');
                        mail('[EMAIL PROTECTED]', date('YmdHim').'.const.txt', 
'');
                }

                function __destruct()
                {
                        fopen(date('YmdHim').'.dest.txt', 'w');
                        mail('[EMAIL PROTECTED]', date('YmdHim').'.dest.txt', 
'');
                }
        }

        $foo = new foo();
        //$foo = 1;
?>

Expected result:
----------------
Creating two files and sending two mails.

Actual result:
--------------
Only one file was created but two mails was sent. If you remove the
comment on the last line, the second file was created too.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36831&edit=1

Reply via email to