Bug #78396 [NEW]: Second file_put_contents in Shutdown hangs script
| From: | herbert at groot dot jebbink dot nl | Date: | Sat, 10 Aug 2019 13:33:42 +0000 |
| Subject: | Bug #78396 [NEW]: Second file_put_contents in Shutdown hangs script | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222167@lists.php.net to get a copy of this message | ||
From: herbert at groot dot jebbink dot nl
Operating system: Debian Stretch (inside ChromeOS)
PHP version: 7.4.0beta2
Package: *General Issues
Bug Type: Bug
Bug description:Second file_put_contents in Shutdown hangs script
Description:
------------
The second file_put_contents to the same file inside the Shutdown
function does never happen, the script hangs.
When removing the 'LOCK_EX' option it works.
The setup is a own build inside Debian Stretch inside ChromeOS (with
crouton), Apache is used from the Stretch distribution.
./configure --with-apxs2=/usr/bin/apxs2
--with-mysql-sock=/run/mysqld/mysqld.sock --enable-mbstring
--enable-exif --enable-ftp --with-zip --enable-soap --with-mysqli
--with-pdo-mysql --with-curl --with-openssl --with-zlib --with-bz2
--enable-gd --with-webp --with-jpeg --with-xpm --with-freetype
--with-tidy --with-xsl --with-sodium --enable-shmop --with-mm
--with-pspell --with-pear
The content of php.ini is
zend_extension=opcache.so
max_execution_time=2
memory_limit=2048M
display_errors=on
error_reporting=E_ALL
Test script:
---------------
<?php
register_shutdown_function ('shutdown');
file_put_contents ('/home/me/data/test.txt', "main 1 \n", FILE_APPEND
| LOCK_EX);
file_put_contents ('/home/me/data/test.txt', "main 2 \n", FILE_APPEND
| LOCK_EX);
a: goto a;
function shutdown () {
$error = error_get_last();
if ( ! is_null($error) ) {
file_put_contents ('/home/me/data/test.txt', "shutdown 1 \n",
FILE_APPEND | LOCK_EX);
file_put_contents ('/home/me/data/test.txt', "shutdown 2 \n",
FILE_APPEND | LOCK_EX);
}
exit;
}
?>
Expected result:
----------------
main 1
main 2
shutdown 1
shutdown 2
Actual result:
--------------
main 1
main 2
shutdown 1
--
Edit bug report at https://bugs.php.net/bug.php?id=78396&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78396&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78396&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78396&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78396&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78396&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78396&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78396&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78396&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78396&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78396&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78396&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78396&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78396&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78396&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78396&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78396&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78396&r=mysqlcfg