|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75769 ASSERT_QUIET_EVAL has no effect
Submitted: 2018-01-05 20:45 UTC Modified: 2020-02-07 18:10 UTC
From: daniel dot jaenecke at gmail dot com Assigned: nikic (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 7.2.1 OS: Linux / not relevant
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 !
Your email address:
Solve the problem:
8 + 27 = ?
Subscribe to this entry?

 [2018-01-05 20:45 UTC] daniel dot jaenecke at gmail dot com
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:

assert_options(ASSERT_QUIET_EVAL, 1);

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-06 13:31 UTC]
ASSERT_QUIET_EVAL only works if assert() is called on a string;
cf. <>. It seems to me that the
documentation has to be improved, and also that ASSERT_QUIET_EVAL
(and maybe other assert_options) should have been deprecated in
PHP 7.2 (where calling assert() with a string argument) has been
 [2019-01-25 16:09 UTC]
@cmb: As we don't really have a concept of deprecation for constants (though maybe we should add one...) we should probably just drop these when we drop support for string asserts in PHP 8, as they will no longer do anything.
 [2020-02-07 11:29 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.

ini_set('assert.quiet_eval', '1');
set_error_handler(function () { echo error_reporting(); });

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?
 [2020-02-07 18:10 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-02-07 18:10 UTC]
ASSERT_QUIET_EVAL has been removed in PHP 8, so closing this issue.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon May 25 19:01:24 2020 UTC