php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

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


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

Test script:
---------------
<?php

set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
	var_dump($context);
});

$a = 1;
$$a = 2;


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

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

Patches

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