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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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)

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 25 04:01:38 2024 UTC