#37246 [Com]: Cannot write files in __destruct()

2006-04-30 Thread judas dot iscariote at gmail dot com
 ID:   37246
 Comment by:   judas dot iscariote at gmail dot com
 Reported By:  mass at carlsoft dot net
 Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Kubuntu 5.10
 PHP Version:  5.1.2
 New Comment:

AFAIK this is the expected behaviuor.destructors are called at script
shutdown, and most parts of the engine are already deactivated.

A PHP dev can correct me if Im wrong.


Previous Comments:


[2006-04-29 19:23:50] mass at carlsoft dot net

Description:

A warning is thrown when trying to use file_put_contents in the
destructor of a class.  It reports that permission was denied, but the
directory and all children are chmod'd to 777.  Additionally, I can
write to the file any other time in the script.

Reproduce code:
---
class test
{
 public function __destruct()
 {
   file_put_contents('somefile','somedata');
 }
}

$foo = new test;

Expected result:

somefile contain somedata

Actual result:
--
Warning with a permission error





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


#37246 [Com]: Cannot write files in __destruct()

2006-04-30 Thread judas dot iscariote at gmail dot com
 ID:   37246
 Comment by:   judas dot iscariote at gmail dot com
 Reported By:  mass at carlsoft dot net
 Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Kubuntu 5.10
 PHP Version:  5.1.2
 New Comment:

...and you get permission denied because at some point of the script
shutdown, apache chdir() to SERVER_ROOT.


Previous Comments:


[2006-04-30 06:38:05] judas dot iscariote at gmail dot com

AFAIK this is the expected behaviuor.destructors are called at script
shutdown, and most parts of the engine are already deactivated.

A PHP dev can correct me if Im wrong.



[2006-04-29 19:23:50] mass at carlsoft dot net

Description:

A warning is thrown when trying to use file_put_contents in the
destructor of a class.  It reports that permission was denied, but the
directory and all children are chmod'd to 777.  Additionally, I can
write to the file any other time in the script.

Reproduce code:
---
class test
{
 public function __destruct()
 {
   file_put_contents('somefile','somedata');
 }
}

$foo = new test;

Expected result:

somefile contain somedata

Actual result:
--
Warning with a permission error





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