ID:               29164
 Updated by:       [EMAIL PROTECTED]
 Reported By:      riorius at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows 2000 Pro
 PHP Version:      5.0.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.




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

[2004-07-19 20:19:56] riorius at hotmail dot com

Based on "kaspersv at privat dot dk"'s comment, I found a workaround. 
Since the script tries to open a file in the apache root directory
rather than the script's directory, the solution is to specify the
entire path:

$out = fopen(dirname($_SERVER['PATH_TRANSLATED']) . "/save.txt", "w");

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

[2004-07-14 23:53:11] kaspersv at privat dot dk

This bug is probably a variation of the same problem that I
experienced. Try changing the permissions for the apache-root folder
(e.g. C:\Program Files\Apache Group\Apache on my computer).

http://bugs.php.net/bug.php?id=29167

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

[2004-07-14 22:08:50] riorius at hotmail dot com

Description:
------------
In my script, a user-defined class is instantiated, and a reference is
maintained until the script's end.  When the script ends, the class's
__destruct() method is called.  Inside of the __destruct() method for
this class, I was trying to open a file on the server to save data.

Reproduce code:
---------------
<?php
class Foo
{
    function __destruct()
    {
        $out = fopen("save.txt", "w");
        fwrite($out, $info);
    }
}

$temp = new Foo();
?>

Expected result:
----------------
I expected that, when the script ended, the __destruct() method would
be called, and it would successfully open the file and save the data.

Actual result:
--------------
When opening a file for writing, I would get a warning, "failed to open
stream: Permission denied"; if I tried to open a file for reading, I
would get a different warning, "failed to open stream: No such file or
directory".

Neither of these errors are appropriate: all permissions were
available, the file was already created.  If I used the exact same code
in another method, or destroyed the reference to the class before the
script's termination (thus causing the __destruct() method to be called
earlier), the file would open and write with no problems.  This only
arose when the reference to my object was destroyed by the script's
termination.


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


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

Reply via email to