php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73789 Strange behavior of class constants in switch/case block
Submitted: 2016-12-19 19:04 UTC Modified: 2016-12-20 11:51 UTC
From: oliver dot hader at typo3 dot org Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 7.1.0 OS: Mac OS
Private report: No CVE-ID:
 [2016-12-19 19:04 UTC] oliver dot hader at typo3 dot org
Description:
------------
The behavior occurs only in PHP 7.1.0 CGI context, using the CLI wrapper everything works as expected. Besides that, the scenario seems to at least require a switch/case block, several class constants and constant look-ups and multiple return types.

Find further down the minimal source code that is required to reproduce this issue. Parts of the code were taken from the TYPO3 CMS project, where this issue has been identified and worked around in a specific patch (https://review.typo3.org/#/c/50998/).

On executing the test script, the PHP process hangs and consumes a lot of CPU.

Test script:
---------------
see https://gist.github.com/ohader/ed0093e95f7f88714903425021f2b426


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-19 19:12 UTC] oliver dot hader at typo3 dot org
I forgot to mention, that I could reproduce this behavior in PHP 7.1-RC5 as well.
 [2016-12-20 11:32 UTC] cmb@php.net
> The behavior occurs only in PHP 7.1.0 CGI context, using the CLI
> wrapper everything works as expected.

Is this perhaps on OPcache issue?
 [2016-12-20 11:45 UTC] laruence@php.net
could you please verify if following path works?

https://gist.github.com/laruence/54ad3436af0f46aac8f8009f25558d49
 [2016-12-20 11:51 UTC] laruence@php.net
-Status: Open +Status: Analyzed
 [2016-12-20 13:02 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6bd41a1d47417ad2c7938a57c8abca4e210d5cf6
Log: Fixed bug #73789 (Strange behavior of class constants in switch/case block)
 [2016-12-20 13:02 UTC] laruence@php.net
-Status: Analyzed +Status: Closed
 [2016-12-20 15:36 UTC] oliver dot hader at typo3 dot org
I can confirm that the issue was OPcache-related and that provided fix solved the issue. Thanks for taking care!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Feb 21 14:01:44 2017 UTC