Bug #78396 [Ver->Opn]: Second file_put_contents in Shutdown hangs script

From: Date: Sat, 10 Aug 2019 14:10:31 +0000
Subject: Bug #78396 [Ver->Opn]: Second file_put_contents in Shutdown hangs script
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222169@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78396&edit=1 ID: 78396 User updated by: herbert at groot dot jebbink dot nl Reported by: herbert at groot dot jebbink dot nl Summary: Second file_put_contents in Shutdown hangs script -Status: Verified +Status: Open Type: Bug Package: *General Issues Operating System: Debian Stretch (inside ChromeOS) PHP Version: 7.4.0beta2 Block user comment: N Private report: N New Comment: The fact that the shutdown function in my test script was activated by a max-execution-time exception is not relevant. Below test script has the same problem. <?php register_shutdown_function ('shutdown'); file_put_contents ('/tmp/test.txt', '1', FILE_APPEND | LOCK_EX); file_put_contents ('/tmp/test.txt', '2', FILE_APPEND | LOCK_EX); function shutdown () { file_put_contents ('/tmp/test.txt', '3', FILE_APPEND | LOCK_EX); file_put_contents ('/tmp/test.txt', '4', FILE_APPEND | LOCK_EX); } ?> Previous Comments: ------------------------------------------------------------------------ [2019-08-10 14:08:08] sjon@php.net without looking into this further, this seems to fail since alpha3 https://3v4l.org/MM3fT ------------------------------------------------------------------------ [2019-08-10 13:33:42] herbert at groot dot jebbink dot nl 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 this bug report at https://bugs.php.net/bug.php?id=78396&edit=1

« previous php.bugs (#222169) next »