|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80234 user-defined error handler and string numeric keys in $errcontext
Submitted: 2020-10-14 11:36 UTC Modified: -
From: david at grudl dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.4.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david at grudl dot com
New email:
PHP Version: OS:


 [2020-10-14 11:36 UTC] david at grudl dot com
Array $context passed to custom error handler is non-standard because contains string numeric keys. Example:

Because $context is deprecated, there is no need to fix it, I just wanted to document it.

Test script:

set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {

$a = 1;
$$a = 2;

Expected result:
array(3) { [1]=> int(2), ... }

Actual result:
array(3) { ["1"]=> int(2), ... }


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 16 23:01:23 2021 UTC