php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76534 PHP hangs on 'illegal string offset on string references with an error handler
Submitted: 2018-06-27 02:08 UTC Modified: -
From: rowan dot f dot leeder at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.2.7 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rowan dot f dot leeder at gmail dot com
New email:
PHP Version: OS:

 

 [2018-06-27 02:08 UTC] rowan dot f dot leeder at gmail dot com
Description:
------------
Using array assignment on a string reference usually causes a fatal 'Illegal string offset' error.

PHP hang when a using an error handler that converts errors to exceptions.

This only effects invalid array access on references. An illegal array access on a non reference variable causes the exception to be emitted. 



Test script:
---------------
set_error_handler(function ($severity, $message, $file, $line) {
    throw new \Exception($message);
});

$x = "foo";
$y = &$x["bar"];


Expected result:
----------------
PHP Fatal error:  Uncaught Exception: Illegal string offset 'bar' in ...


Patches

PHP12345678 (last revision 2018-09-17 20:48 UTC by kaaffay at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-27 05:10 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d1b1866a3a035b946e50b17eeefd19add81c7eab
Log: Fixed bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler)
 [2018-06-27 05:10 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC