php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53906 Problem at file creation in a class destructor
Submitted: 2011-02-02 12:20 UTC Modified: 2011-02-03 07:09 UTC
From: denisk at rg dot ru Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: PHP 5.3.3 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: denisk at rg dot ru
New email:
PHP Version: OS:

 

 [2011-02-02 12:20 UTC] 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();

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-02 18:48 UTC] kalle@php.net
-Status: Open +Status: Bogus
 [2011-02-02 18:48 UTC] 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-03 07:09 UTC] denisk at rg dot ru
-PHP Version: Irrelevant +PHP Version: PHP 5.3.3
 [2011-02-03 07:09 UTC] denisk at rg dot ru
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,TS,VC6
PHP Extension Build	API20090626,TS,VC6
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC