php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73163 PHP hangs if error handler throws while accessing undef const in default value
Submitted: 2016-09-24 10:59 UTC Modified: 2016-09-24 10:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: nikic@php.net Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.11 OS:
Private report: No CVE-ID: None
 [2016-09-24 10:59 UTC] nikic@php.net
Description:
------------
If an undefined unqualified constant is used in a parameter default value and a registered error handler converts the "undefined constant" notice into an exception PHP will hang.

This only happens if global registers are used.

Test script:
---------------
<?php
error_reporting(E_ALL);

function doSomething(string $value = UNDEFINED_XYZ) {
}

set_error_handler(function() {
    throw new Exception;
});

doSomething();

Expected result:
----------------
Exception is thrown

Actual result:
--------------
PHP enters an infinite loop

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-24 10:59 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2016-09-24 11:24 UTC] nikic@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8831a12da1671bcfca8607d5af505d69ba938917
Log: Fixed bug #73163
 [2016-09-24 11:24 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2016-10-17 10:07 UTC] bwoebi@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8831a12da1671bcfca8607d5af505d69ba938917
Log: Fixed bug #73163
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC