Bug #54424 [Opn->Wfx]: failed assert with ASSERT_BAIL exits with return code == 0
| From: | cmb@php.net | Date: | Mon, 15 Feb 2021 14:06:20 +0000 |
| Subject: | Bug #54424 [Opn->Wfx]: failed assert with ASSERT_BAIL exits with return code == 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232169@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54424&edit=1
ID: 54424
Updated by: cmb@php.net
Reported by: jakub dot lopuszanski at nasza-klasa dot pl
Summary: failed assert with ASSERT_BAIL exits with return
code == 0
-Status: Open
+Status: Wont fix
Type: Bug
-Package: *General Issues
+Package: PHP options/info functions
Operating System: linux
PHP Version: 5.3.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> Failed assertions should be signaled by non-zero return code
> from the script as they are errors.
Right. However, the usage of assert_options() is discouraged as
of PHP 7.0.0; use assert.exceptions instead, and the
AssertionError, if not caught, will set a non-zero exit status. I
don't think that fixing the behavior of ASSERT_BAIL would still be
sensible at this point in time.
Previous Comments:
------------------------------------------------------------------------
[2011-03-30 15:04:16] jakub dot lopuszanski at nasza-klasa dot pl
Description:
------------
Failed assertions should be signaled by non-zero return code from the script as they are errors.
Test script:
---------------
$ cat example.php
<?php
assert_options(ASSERT_BAIL, true);
assert(false);
?>
$ php example.php
PHP Warning: assert(): Assertion failed in /home/lopuszanski/projects/NK-2/tests/php/example.php on
line 3
$ echo $?
0
Expected result:
----------------
echo $? should display some nonzero return code
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54424&edit=1