php.net |  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: 2019-01-25 16:09 UTC
From: daniel dot jaenecke at gmail dot com Assigned:
Status: Open Package: PHP options/info functions
PHP Version: 7.2.1 OS: Linux / not relevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel dot jaenecke at gmail dot com
New email:
PHP Version: OS:

 

 [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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-06 13:31 UTC] cmb@php.net
ASSERT_QUIET_EVAL only works if assert() is called on a string;
cf. <https://3v4l.org/k2rbK>. 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
deprecated).
 [2019-01-25 16:09 UTC] nikic@php.net
@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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:26 2019 UTC