php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76536 PHP crashes with core dump when throwing exception in error handler
Submitted: 2018-06-27 09:36 UTC Modified: -
From: diacomltd at mail dot ru Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.2.7 OS: Linux (different vesions)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
19 - 7 = ?
Subscribe to this entry?

 
 [2018-06-27 09:36 UTC] diacomltd at mail dot ru
Description:
------------
PHP crashes with core dump when throwing exception in error handler. The bug reproduces with PHP starting from version 7.1, but not before. Checked under different Linux versions

Came into it when using PHP introspection functions on class with incorrect constants declaration. Don't know if the bug relates to this specific mistake or not. 


Test script:
---------------
class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;}

function handleError() {throw new ErrorException();}

set_error_handler('handleError');
set_exception_handler('handleError');

$r = new \ReflectionClass(SomeConstants::class);
$r->getConstants();

Expected result:
----------------
Fatal error: Uncaught exception 'ErrorException' in /code/1.php:10
Stack trace:
#0 [internal function]: handleError(Object(ErrorException))
#1 {main}
  thrown in /code/1.php on line 10

Actual result:
--------------
Segmentation fault (core dumped)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-28 04:39 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1f6b842af430b8cbba0fb1c38a2796ab399171c3
Log: Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence)
 [2018-06-28 04:39 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC