From: teunkloosterman at gmail dot com
Operating system: Linux
PHP version: 5.0.1
PHP Bug Type: Feature/Change Request
Bug description: file_put_contents
Description:
------------
The file_put_contents function doesn't return anything on an error, it
would be better if for example: on a permission error, I could catch an
error instead of a big message and no result
Reproduce code:
---------------
if(file_put_contents("./file", " ") === FALSE)
{
exit("error, could not write to file");
}
else
{
echo "Yay, file is completed";
}
Expected result:
----------------
error, could not write to file
Actual result:
--------------
Warning: file_put_contents(./file) [function.file-put-contents]: failed to
open stream: Permission denied in /var//www/test.php on line 2
--
Edit bug report at http://bugs.php.net/?id=30531&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30531&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30531&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30531&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30531&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30531&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30531&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30531&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30531&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30531&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30531&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30531&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30531&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30531&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30531&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30531&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30531&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30531&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30531&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30531&r=mysqlcfg