Bug #53906 [Bgs]: Problem at file creation in a class destructor

From: Date: Thu, 03 Feb 2011 06:09:23 +0000
Subject: Bug #53906 [Bgs]: Problem at file creation in a class destructor
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158447@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53906&edit=1

 ID:                 53906
 User updated by:    denisk at rg dot ru
 Reported by:        denisk at rg dot ru
 Summary:            Problem at file creation in a class destructor
 Status:             Bogus
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Windows
-PHP Version:        Irrelevant
+PHP Version:        PHP 5.3.3
 Block user comment: N
 Private report:     N

 New Comment:

PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,TS,VC6
PHP Extension Build	API20090626,TS,VC6


Previous Comments:
------------------------------------------------------------------------
[2011-02-02 18:48:04] kalle@php.net

Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.



------------------------------------------------------------------------
[2011-02-02 12:20:01] denisk at rg dot ru

Description:
------------
PHP 5.3.3 or early
There is no file creation if to specify a relative path in a class
destructor.

Test script:
---------------
Not work.

<?php

class MyClass
{
     public function __destruct()
     {
         file_put_contents('./filename.txt', 'text');
     }
}

$Object = new MyClass();

?>

Actual result:
--------------
It works:
<?php

class MyClass
{
     public function __destruct()
     {
         file_put_contents('./filename.txt', 'text');
     }
}

$Object = new MyClass();
unset($Object);

?>

or

<?php

class MyClass
{
     public function __destruct()
     {
         file_put_contents($_SERVER['DOCUMENT_ROOT']. '/filename.txt',
'text');
     }
}

$Object = new MyClass();

?>


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



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


Thread (3 messages)

« previous php.bugs (#158447) next »