|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-03-15 19:45 UTC] [email protected]
-Status: Open
+Status: Feedback
[2019-03-15 19:45 UTC] [email protected]
[2019-03-15 22:21 UTC] michael dot mauch at gmx dot de
-Status: Feedback
+Status: Open
[2019-03-15 22:21 UTC] michael dot mauch at gmx dot de
[2019-03-16 02:41 UTC] [email protected]
[2019-03-16 10:08 UTC] michael dot mauch at gmx dot de
[2019-03-16 10:18 UTC] michael dot mauch at gmx dot de
[2019-03-16 10:25 UTC] michael dot mauch at gmx dot de
[2019-03-16 11:40 UTC] michael dot mauch at gmx dot de
[2019-03-16 12:42 UTC] [email protected]
-Status: Open
+Status: Verified
[2019-03-16 12:42 UTC] [email protected]
[2019-03-16 13:19 UTC] [email protected]
-Status: Verified
+Status: Open
[2019-03-16 13:19 UTC] [email protected]
[2019-03-18 10:10 UTC] [email protected]
-Assigned To:
+Assigned To: dmitry
[2019-03-18 10:10 UTC] [email protected]
[2023-10-14 21:58 UTC] [email protected]
-Package: Output Control
+Package: Streams related
[2023-10-14 22:02 UTC] [email protected]
-Package: Streams related
+Package: SPL related
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 26 08:00:01 2025 UTC |
Description: ------------ I'm using a function like below to redirect all output to a log file in PHP CLI scripts. It works until PHP 7.1, but crashes with SIGSEGV in 7.2 and 7.3. If I use old fopen() instead of SplFileObject, it also works with 7.2 and 7.3. Oracle Linux 7.x at work, Ubuntu 16.04 at home, or even in docker with the official images. Test script: --------------- <?php $logfilename = "/tmp/crash.log"; $logfile = new SplFileObject($logfilename, "w"); ob_start(function ($buffer) use ($logfile) { $logfile->fwrite($buffer); $logfile->fflush(); return ""; }); echo "hmm\n"; Expected result: ---------------- # Like with PHP 7.1: % docker run -it --rm -v "$PWD":/tmp -w /tmp php:7.1-cli /bin/bash -c 'ulimit -c unlimited; php -v; php ./crash.php && echo ok' PHP 7.1.27 (cli) (built: Mar 9 2019 02:51:22) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies ok Actual result: -------------- # But with PHP 7.3: % docker run -it --rm -v "$PWD":/tmp -w /tmp php:cli /bin/bash -c 'ulimit -c unlimited; php -v; php ./crash.php && echo ok' PHP 7.3.3 (cli) (built: Mar 9 2019 00:27:53) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies /bin/bash: line 1: 7 Segmentation fault (core dumped) php ./crash.php