|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80094 want a "error_reporting level at time of creation" for errors
Submitted: 2020-09-12 07:59 UTC Modified: 2020-09-12 08:11 UTC
From: divinity76 at gmail dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: Next Minor Version OS:
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.
Bug Type:
From: divinity76 at gmail dot com
New email:
PHP Version: OS:


 [2020-09-12 07:59 UTC] divinity76 at gmail dot com
with error_get_last() i wish there was some way to check the error_reporting level at the time that error was created (or perhaps at the time it was triggered?), in particular, i've been in a situation where i wanted to know if it was triggered in a statement prepended with the error-suppression operator (`@`) or not (which makes error_reporting 0 for the duration of the statement), but seems there's no easy way to check that (could read the source code and check if that specific line has `@` in it, but if it's a line with multiple statements, one could easily get a "false positive" by reading the wrong `@`, also the error-suppression-operator doesn't even have to be on the same line as the the statement it's suppressing, so..)

Test script:
@$a = $b;


Expected result:
array(5) {
  string(21) "Undefined variable $b"
  string(9) "/in/olPd9"

Actual result:
array(4) {
  string(21) "Undefined variable $b"
  string(9) "/in/olPd9"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-12 08:11 UTC]
Using a custom set_error_handler should work for that purpose -- any reason not to do that?

Apart from that, this seems like a reasonable request.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 22:01:27 2024 UTC