ID:               29167
 Comment by:       hans dot duedal at gmail dot com
 Reported By:      kaspersv at privat dot dk
 Status:           No Feedback
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5.0.0
 Assigned To:      helly
 New Comment:

As [EMAIL PROTECTED] said, it's an shutdown order problem. Calling unset
explicitly solves the problem, which also affects the unlink function.

I was trying to create a destructor that would remove a temporary file.


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

[2004-08-03 01:00:05] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2004-07-25 21:10:53] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2004-07-15 18:25:27] [EMAIL PROTECTED]

Nothing to do with fopen, but instead the shutdown order;
reclassifying.

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

[2004-07-15 09:12:46] [EMAIL PROTECTED]

ATM you need to explicitly unset the object before script termination
by using:
unset($bugtest);

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

[2004-07-14 23:44:15] kaspersv at privat dot dk

Description:
------------
When I run the attached code on my machine, it creates a file called
testing.txt in the directory where the php-file was located, containing
the line "Constructor". And another file in the apache servers root
directory also called testing.txt, containing the line "Destructor". 

Reproduce code:
---------------
<?
        
        class BugTest {
                function __construct() {
                        $fp = fopen("testing.txt", "a");
                        fwrite($fp, "Constructor\n");
                        fclose($fp);
                }
                
                function __destruct() {
                        $fp = fopen("testing.txt", "a");
                        fwrite($fp, "Destructor\n");
                        fclose($fp);
                }
        }
        
        $bugtest = new BugTest();

?>

Expected result:
----------------
A single file containing the two lines: 
Constructor
Destructor



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


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

Reply via email to