|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-12 08:11 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
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) }