Bug #75955 [NEW]: cli and php-fpm assert Behave Differently

From: Date: Tue, 13 Feb 2018 05:55:10 +0000
Subject: Bug #75955 [NEW]: cli and php-fpm assert Behave Differently
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213934@lists.php.net to get a copy of this message
From: xmlscript at gmail dot com Operating system: Fedora 27 PHP version: 7.2.2 Package: Scripting Engine problem Bug Type: Bug Bug description:cli and php-fpm assert Behave Differently Description: ------------ I want to get assertion code "assert(sleep(3))", but return "Assertion failed" or $exception->getMessage() === "". =========================================================== php -r 'assert_options(ASSERT_ACTIVE,true);assert(sleep(3));' PHP Warning: assert(): **assert(sleep(3))** failed in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 PHP 2. assert() Command line code:1 Warning: assert(): **assert(sleep(3))** failed in Command line code on line 1 Call Stack: 0.0001 406984 1. {main}() Command line code:0 3.0001 407360 2. assert() Command line code:1 =========================================================== script file "test.php": <?php echo PHP_SAPI,PHP_EOL; assert_options(ASSERT_ACTIVE,true); assert(sleep(3)); ?> =========================================================== lynx localhost/test.php fpm-fcgi ( ! ) Warning: assert(): **Assertion failed** in /path/to/test.php on line 4 Call Stack # Time Memory Function Location 1 0.0002 406992 {main}( ) .../exception.php:0 2 3.0003 407368 assert ( ) .../exception.php:4 =========================================================== php test.php cli PHP Warning: assert(): **Assertion failed** in /path/to/test.php on line 4 PHP Stack trace: PHP 1. {main}() /path/to/test.php:0 PHP 2. assert() /path/to/test.php:4 Warning: assert(): Assertion failed in /path/to/test.php on line 4 Call Stack: 0.0001 407896 1. {main}() /path/to/test.php:0 3.0002 408304 2. assert() /path/to/test.php:4 =========================================================== php -r 'assert_options(ASSERT_ACTIVE,true);assert_options(ASSERT_EXCEPTION,true);assert(sleep(3));' PHP Fatal error: Uncaught AssertionError: **assert(sleep(3))** in Command line code:1 Stack trace: #0 Command line code(1): assert(0, 'assert(sleep(3)...') #1 {main} thrown in Command line code on line 1 Fatal error: Uncaught AssertionError: **assert(sleep(3))** in Command line code on line 1 AssertionError: assert(sleep(3)) in Command line code on line 1 Call Stack: 0.0000 407384 1. {main}() Command line code:0 3.0001 407760 2. assert() Command line code:1 =========================================================== script file "test_with_exception.php": <?php echo PHP_SAPI,PHP_EOL; assert_options(ASSERT_ACTIVE,true); assert_options(ASSERT_EXCEPTION,true); assert(sleep(3)); ?> =========================================================== lynx localhost/test_with_exception.php fpm-fcgi ( ! ) Fatal error: Uncaught AssertionError in /path/to/test_with_exception.php on line 5 ( ! ) AssertionError: in /path/to/test_with_exception.php on line 5 Call Stack # Time Memory Function Location 1 0.0001 407496 {main}( ) .../test_with_exception.php:0 2 3.0002 407872 assert ( ) .../test_with_exception.php:5 =========================================================== php test_with_exception.php cli PHP Fatal error: Uncaught AssertionError in /path/to/test_with_exception.php:5 Stack trace: #0 /path/to/test_with_exception.php(5): assert(0) #1 {main} thrown in /path/to/test_with_exception.php on line 5 Fatal error: Uncaught AssertionError in /path/to/test_with_exception.php on line 5 AssertionError: in /path/to/test_with_exception.php on line 5 Call Stack: 0.0001 408408 1. {main}() /var/www/vhost/e/exception.php:0 3.0002 408816 2. assert() /var/www/vhost/e/exception.php:5 -- Edit bug report at https://bugs.php.net/bug.php?id=75955&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75955&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75955&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75955&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75955&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75955&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75955&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75955&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75955&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75955&r=support Expected behavior: https://bugs.php.net/fix.php?id=75955&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75955&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75955&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75955&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75955&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75955&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75955&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75955&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75955&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75955&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75955&r=mysqlcfg

« previous php.bugs (#213934) next »