Req #80094 [NEW]: want a "error_reporting level at time of creation" for errors
| From: | divinity76 at gmail dot com | Date: | Sat, 12 Sep 2020 07:59:59 +0000 |
| Subject: | Req #80094 [NEW]: want a "error_reporting level at time of creation" for errors | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228981@lists.php.net to get a copy of this message | ||
From: divinity76 at gmail dot com
Operating system:
PHP version: Next Minor Version
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:want a "error_reporting level at time of creation" for errors
Description:
------------
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:
---------------
<?php
unset($b);
@$a = $b;
var_dump(error_get_last());
Expected result:
----------------
array(5) {
["type"]=>
int(2)
["message"]=>
string(21) "Undefined variable $b"
["file"]=>
string(9) "/in/olPd9"
["line"]=>
int(3)
["error_reporting_level"]=>
int(0)
}
Actual result:
--------------
array(4) {
["type"]=>
int(2)
["message"]=>
string(21) "Undefined variable $b"
["file"]=>
string(9) "/in/olPd9"
["line"]=>
int(3)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80094&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80094&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80094&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80094&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80094&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80094&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80094&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80094&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80094&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80094&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80094&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80094&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80094&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80094&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80094&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80094&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80094&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80094&r=mysqlcfg