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
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.
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