Edit report at https://bugs.php.net/bug.php?id=49396&edit=1
ID: 49396 Comment by: Laurent dot Lyaudet at gmail dot com Reported by: phpbugs at jan-o-sch dot net Summary: Need access to system errno Status: Open Type: Feature/Change Request Package: *General Issues Operating System: * PHP Version: * Block user comment: N Private report: N New Comment: While touch is a user level function as are the ftp functions, I still think a better error handling is needed. Previous Comments: ------------------------------------------------------------------------ [2013-07-23 14:14:31] Laurent dot Lyaudet at gmail dot com Hi, I want to add up to this feature/change request. In particular for ftp functions. Here is my report and a test script. I did a few tests with ftp functions: it would be better for ftp_nlist to return error codes. Right now the situation is the following : - with an invalid resource (ftp_nlist(0,'.') for example), it will return NULL - if you're not loggued in, it will return false - if you're loggued in, it will return an array - if you kill the connexion on the server, it will return false BUT you will not be able to log in again with the same resource. You have to close the connexion and create a new one with connect. Moreover, you somehow have two kinds of invalid resources: - arbitrary doubles, - killed connexions. Best regards, Laurent Lyaudet vm3:~# php <?php $con = ftp_connect(@myIP@); ftp_login($con, @myLogin@, @myPassword@); sleep(11); //kill the ftp process on the server $test = ftp_login($con, @myLogin@, @myPassword@); $res = ftp_nlist($con,'./test'); var_dump($res); var_dump($test); ?> ------------------------------------------------------------------------ [2009-08-28 07:56:19] phpbugs at jan-o-sch dot net Description: ------------ All system level php functions only return boolean values, which makes generic error handling easy. However, for a more sophisticated error handling, access to errno is required. For example: I try to touch() a file and touch() returns false. The only hint I can get is using an error handler or calling error_get_last(), none of which provides me with an errno value. Yes, I do want to react differently to EPERM and EDQUOT. No, I do not want to parse "touch(): Unable to create file /fail because Permission denied". Alternatively, having posix_* versions of all system functions would allow one to use posix_get_last_error(). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=49396&edit=1