|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
15 + 43 = ?
Subscribe to this entry?

 [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: Mon Apr 22 04:01:31 2024 UTC