php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30531 file_put_contents
Submitted: 2004-10-22 14:32 UTC Modified: 2004-10-30 01:00 UTC
From: teunkloosterman at gmail dot com Assigned:
Status: No Feedback Package: Feature/Change Request
PHP Version: 5.0.1 OS: Linux
Private report: No CVE-ID: None
 [2004-10-22 14:32 UTC] teunkloosterman at gmail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-22 14:37 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Works fine here.
 [2004-10-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC