|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-11-17 19:38 UTC] mav2287 at aol dot com
Description: ------------ As discovered and documented via the Mac Ports project ( see ticket url below ) php versions 7.3.23 & 7.4.11 and newer seem to create a process with runaway CPU usage when attempting to get the last day of the month. This runaway process seems to continue indefinitely and consumes 100% cpu. Orignal Mac Ports Ticket: https://trac.macports.org/ticket/61351 Test script: --------------- # php -a Interactive shell php > $date = new \DateTime(); php > $newDate = $date->modify('last day of this month'); php > var_dump($newDate); Expected result: ---------------- creation of a DateTime object and a blinking cursor awaiting new command Actual result: -------------- PHP will hang indefinitely and the php process will consume 100% cpu until manually killed PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
In case it isn't clear when using the sample script once you execute "$newDate = $date->modify('last day of this month');" PHP will hang. You will never get the chance to go to the next step of the script and do "php > var_dump($newDate);" as the object is never created,I can repro with PHP 7.3.25 on our MacOSX 10.11.6 MacMini as follows: $ sudo port install php73 $ sudo port install php73 +debug $ sudo port activate php73 The following versions of php73 are currently installed: 1) php73 @7.3.25_2+debug+libedit 2) php73 @7.3.25_2+libedit (active) Enter a number to select an option: 1 $ php73 -r 'print (new DateTime( "15 Dec 2020" ))->format("Ymd H:i:s").PHP_EOL;' 20201215 00:00:00 $ php73 -v PHP 7.3.25 (cli) (built: Dec 16 2020 14:43:06) ( NTS DEBUG ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.25, Copyright (c) 1998-2018 Zend Technologies $ sudo port activate php73 The following versions of php73 are currently installed: 1) php73 @7.3.25_2+debug+libedit 2) php73 @7.3.25_2+libedit (active) Enter a number to select an option: 2 $ php73 -r 'print (new DateTime( "15 Dec 2020" ))->format("Ymd H:i:s").PHP_EOL;' ===>>> HANGS! <<<=== $ php73 -v PHP 7.3.25 (cli) (built: Dec 6 2020 20:04:26) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.25, Copyright (c) 1998-2018 Zend Technologies Notes: - This problem suddenly occurred after upgrading from an older PHP 7.3 patch version. (I can't remember the patch level that was still working. I assume it was something close to PHP 7.3.10, like one year old.) - This problem is a major show-stopper for us. We can't go back to an older PHP 7.3 patch level anymore, as we thought it was smart to clear older installations first, once we ran into this problem. - Exactly the same problem happens for PHP 7.4.13 installed on the same machine. - This problem does NOT happen on my MacOSX 10.13.6 MacBook Pro.I did some more digging on the problematic MacOSX 10.11.6 machine. It seems that between end of March 2020 and early October 2020 there were no PHP 7.3 nor PHP 7.4 patches released by MacPorts: -------------------------------------------------------- $ git log --grep "php73" commit 2b90e9dbf0b7c7d330325e724793d1ab6fc0e062 Author: Ryan Schmidt <ryandesign@macports.org> Date: Fri Oct 2 09:59:49 2020 -0500 php: Update php73 to 7.3.23 commit b03fe0675f1efe520c67b13a6ccc17a6f9a99e09 Author: Ryan Schmidt <ryandesign@macports.org> Date: Tue Mar 24 07:24:35 2020 -0500 php: Update php73 to 7.3.16 -------------------------------------------------------- $ git log --grep "php74" commit 2eca46bc0c123000c2ef7efddfd382b411d41dfc Author: Ryan Schmidt <ryandesign@macports.org> Date: Thu Oct 1 18:23:45 2020 -0500 php: Update php74 to 7.4.11 commit 1b2546f94ff2583e3727f7f2df19f72386afc22e Author: Ryan Schmidt <ryandesign@macports.org> Date: Thu Mar 26 09:30:28 2020 -0500 php: Update php74 to 7.4.4 -------------------------------------------------------- I repeated my test (I mentioned in earlier posts) for all these 4 commits listed above. And it turns out that: - 7.3.16 works! - 7.3.23 hangs! - 7.4.4 works! - 7.4.11 hangs! I hope this helps you pinpointing the problem.