Re: [PEPr] +1 for Tools and Utilities::Address_Book
| From: | Alan Knowles | Date: | Sun, 05 Dec 2004 12:46:15 +0000 |
| Subject: | Re: [PEPr] +1 for Tools and Utilities::Address_Book | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34812@lists.php.net to get a copy of this message | ||
Daniel Convissor wrote:
On Sat, Dec 04, 2004 at 02:18:00AM -0000, Alan Knowles wrote:Alan Knowles (http://pear.php.net/user/alan_k) has voted +1 on the proposal for Tools and Utilities::Address_Book. - safemode checking for fopen seems counter intuative - just remove the @ from fopen, and expose the error if the system is set up wrong - let the sysadmin fix it..@fopen() is definitely better than a straight fopen(). If the open attempt fails, PHP generates a warning with file name and path information in it that the general public should not see. that's why report errors is recommended to be turned off on production sites.
Turn track_errors on. If fopen() doesn't work, put $php_errormsg into the getDebugInfo() of an error object. The error object should have some generic message for getMessage() that says a file couldn't be opened, but doesn't give away any details. If it is possible that the file access may fail, doing file_exists/isreadable prior to access is a little better than error hiding - which should really only be regarded as a last resort or a quick/temporary kludge.I can remember the exact context of this one, but if the file is not writable because of safemode being on, then converting a php error / logged to syslog or displayed into a quiet PEAR_Error, for a pretty critical situation seems poor tradeoff. - obviously a exception thrown from fopen would be nice :) Regards Alan
Thanks, --Dan