Re: [PATCH] Make streams respect POSIX error retrieval functions (bug #36868)
| From: | Wez Furlong | Date: | Mon, 27 Mar 2006 12:38:11 +0000 |
| Subject: | Re: [PATCH] Make streams respect POSIX error retrieval functions (bug #36868) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22593@lists.php.net to get a copy of this message | ||
That patch won't work if you build the posix extension shared and don't load it.
In addition, it's most likely too late to capture the real errno value
that you're looking for; PHP does a decent amount of stuff between the
time that the low level syscall fails and the point that you sample
it.
On top of that, the failure code may not even be representable as an
errno--for example, when getaddrinfo() fails the reason is returned in
a different "number space" outside of the usual errno "protocol".
Webdav streams may fail to open due to 404 errors at a level that
doesn't even cause errno to be set, similarly for user-space or other
extension streams.
--Wez.
On 3/27/06, Hannes Magnusson <bjori@php.net> wrote:
> Hi all
>
> Attached is a patch (against HEAD) to allow codes like:
> $fp = @fopen("/unwritabledirectory/filename", "w");
> if (!$fp) {
> printf("The errornr was: %d", posix_get_last_error());
> }
>
> Fixes bug #36868
>
> (If, for what ever reason, the patch doesn't come through:
> http://php.is/bugs/36868/posix.patch.txt )
> - Hannes
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>