php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12465 posix_* issuing Warnings, no error code.
Submitted: 2001-07-30 09:24 UTC Modified: 2002-05-26 14:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: herp at wildsau dot idv dot uni-linz dot ac dot at Assigned:
Status: Closed Package: POSIX related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2001-07-30 09:24 UTC] herp at wildsau dot idv dot uni-linz dot ac dot at
hi,

I tried to use some of the posix_* functions to work with
user-accounts on the system, like "posix_getpwnam()" and
"posix_getpwuid()".

I expected to get an error-code back (like Failed or FALSE)
for pwnames or pwuids which do not exist in /etc/passwd.
Instead, PHP will write a warning message in my html-output:

: Warning: posix_getpwuid(4711) failed with 'Success' in
: /data/home/webmaster/admin/admin.php
: on line 197

and, what I think is strange, will "fail with ?Success?".

Could you please modify the posix_getpw* functions in a
way that they 1) do not write strange warning-messages
 and 2) return a NULL-Value or FALSE, where the unix getpw*(3) will return NULL (just like documented in the
man-page)

thanks in advance,
herbert rosmanith
herp@wildsau.idv.uni-linz.ac.at

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-04 02:46 UTC] yohgaki@php.net
It returns false. You need to get rid of error messages with @...
 [2002-02-28 14:48 UTC] herp at wildsau dot idv dot uni-linz dot ac dot at
It?s still nonsense to write an error-message! stat() *IS  STILL USED* for checking the existence of files. Why do I have to *suppress* error-messages?! PHP should not *generate* them in the first! *If* you choose to implement stat() and name it after the C-function, then stat() should behave as closely as possible like its C-equivalent.
 [2002-02-28 17:48 UTC] mfischer@php.net
I agree with Herbert here.

It's pretty worthless for the function to generate this verbose error messages during runtime. It's mimic is excatly what the C version does (function-wise). Does the C version do any output itself if it encounters an error (e.g. posix_getpwuid) ? No. Why? Because a NULL return value is a valid return value. It's not a php_error() nor a E_WARNING.

Instead, the extension should be re-written to a) return false (the PHP-way), b) store the errno in a thread-global contect variable and c) provide a function to cleanly retrieve the exacty error message (currently, you would habe to catch $php_errmsg (or whatever it was) and parse it out.

Short: re-opening ;)
 [2002-02-28 18:09 UTC] herp at wildsau dot idv dot uni-linz dot ac dot at
ouch, little mistake, I confused two reports (one concerns stat(), the other one (this one) conceners posix_*). But anyway, both reports adress the same behaviour, so my reply is still valid.
 [2002-05-26 14:37 UTC] derick@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 13:01:31 2024 UTC