Bug #69277 [NEW]: PHP-FPM crashes on file_put_contents call

From: Date: Sun, 22 Mar 2015 17:42:09 +0000
Subject: Bug #69277 [NEW]: PHP-FPM crashes on file_put_contents call
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191528@lists.php.net to get a copy of this message
From: sebastien dot vray at gmail dot com Operating system: Fedora 21 3.18.3-201.fc21.i686 PHP version: Irrelevant Package: *Directory/Filesystem functions Bug Type: Bug Bug description:PHP-FPM crashes on file_put_contents call Description: ------------ Let's assume the file foo.txt with read only permissions or 744 chmod and the owner of the PHP-FPM process is not the same as foo.txt, if you try to write something in it with the function file_put_contents you'll get a "503 service unavailable" response from apache plus a ambigous warning in the error log: 22-Mar-2015 17:47:27 Europe/Paris] PHP Warning: file_put_contents(foo.txt): °¶»áÈ in /var/www/xxx/api/Library/Log.php on line 121 While using respectively fopen(), fwrite(), and fclose() on the same file with the same conditions and appropriate controls will produce nothing. My PHP version is 5.6.4 Test script: --------------- <?php //foo.txt has 444 chmod or PHP-FPM user doesn't have the appropriate write permissions on the file //This makes PHP-FPM crash file_put_contents('foo.txt', 'Whatever', FILE_APPEND);//Makes PHP-FPM crash //While this doesn't $fpLog = @fopen($path, 'ba+'); if ($fpLog) { @fwrite($fp, $content); @fclose($fpLog); } -- Edit bug report at https://bugs.php.net/bug.php?id=69277&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69277&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69277&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69277&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69277&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69277&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69277&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69277&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69277&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69277&r=support Expected behavior: https://bugs.php.net/fix.php?id=69277&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69277&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69277&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69277&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69277&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69277&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69277&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69277&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69277&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69277&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69277&r=mysqlcfg

« previous php.bugs (#191528) next »