ID:               30267
 Updated by:       [EMAIL PROTECTED]
 Reported By:      eiriksletteberg at hotmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 98SE
 PHP Version:      5.0.1
 New Comment:

Please try using this CVS snapshot:

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

Cannot replicate on either windows or linux.


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

[2004-09-30 00:48:41] htmldoug at msn dot com

Reproduction code run using PHP 5.0.2 under WinXP executes exactly as
expected.

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

[2004-09-28 21:31:16] eiriksletteberg at hotmail dot com

Description:
------------
When this code is executed, one would expect data.txt
to contain "Hello World!". And, as file_get_contents() says,
it is. But when the script is completely executed, data.txt
does not contain "Hello World!" as it should. The
error does not occur if the destructor is called before
the script ends, eg. by unset()'ing $foo. Seems
like the destructor cannot write to files when called
at the end of scripts?!?

Reproduce code:
---------------
<?php
class data
{
   function __destruct()
   {
       $data = "Hello World!";

       // Show that the destructor is called
       print "Destructor called.";

       $link = fopen("data.txt", 'w');
       fwrite($link, $data);
       fclose($link);
       
       // Check if we have written it
       print "Contents: ".file_get_contents("data.txt");
   }
}
$foo = new data;
?>

Expected result:
----------------
data.txt should contain "Hello World!"

Actual result:
--------------
data.txt is empty or contains the previous value


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


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

Reply via email to