Re: destructor not getting called.
| From: | Tomas V.V.Cox | Date: | Mon, 10 Sep 2001 22:59:02 +0000 |
| Subject: | Re: destructor not getting called. | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-312@lists.php.net to get a copy of this message | ||
Matt Giddings wrote:
>
> I do call $this->PEAR() within the constructor and the thing still doesn't
> work. Whats supposed to happen is all the updated data is supposed to be
> written to a file when the destructor is called, this doesn't happen unless
> I explicity call the destructor myself. Heres the code I'm using, which is
> pretty much the example given within the pear documentation.
>
> ------8< start of example code >8------
>
[..]
>
>
> ------8< end of example code >8------
>
That was difficult to track. I ran the code with the php script version
(php 4.0.7) an all went good, but I couldn't make it work with apache
(php 4.0.6). After some research I found that in apache mode, the script
loose the actual path, using "/" instead. So you were trying to write
the file in "/testfile", getting the obvious error "no perms" (you could
see the error message setting the php.ini directive: log_errors to On).
Add to the file name the complete path to make it work.
That's definetly a bug in PHP in my opinion (don't know if was a 4.0.6
bug or only as apache module).
Any way, here is a test script:
<?php
register_shutdown_function('test');
function test() {
trigger_error('trying to write in ' . getCwd(), E_USER_ERROR);
}
echo "end";
?>
When I try to access to http://localhost/b/test.php, I
get the following
error logged:
PHP Fatal error: trying to write in / in /home/httpd/html/b/test.php on
line 4
Tomas V.V.Cox