|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-01-05 20:45 UTC] daniel dot jaenecke at gmail dot com
Description: ------------ As far as I understand from the documentation setting ASSERT_QUIET_EVAL / assert.quiet_eval to 1 should suppress any error message triggered when evaluating an assertion. Either this is not the case or I misunderstand the (rather scarce) documentation on this option. Test script: --------------- <?php error_reporting(E_ALL); assert_options(ASSERT_QUIET_EVAL, 1); assert($foo); Expected result: ---------------- Warning: assert(): assert($foo) failed in […] on line 5 Actual result: -------------- Notice: Undefined variable: foo in […] on line 5 Warning: assert(): assert($foo) failed in […] on line 5 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 03:00:01 2025 UTC |
> ASSERT_QUIET_EVAL only works if assert() is called on a string; Actually, I was like the reporter: expecting this to have effect when using PHP7-style assertions. ```php ini_set('assert.quiet_eval', '1'); set_error_handler(function () { echo error_reporting(); }); assert(false); ``` This should echo "0" to me. That's what we'd all understand by reading the doc, and what is the most useful. Can we consider fixing this behavior?