Bug #75950 [Fbk->NoF]: when zend.assertions=-1, and assert(sleep(5)); assertions is NOT zero-cost.
| From: | php-bugs at lists dot php dot net | Date: | Sun, 14 Feb 2021 04:22:08 +0000 |
| Subject: | Bug #75950 [Fbk->NoF]: when zend.assertions=-1, and assert(sleep(5)); assertions is NOT zero-cost. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232146@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75950&edit=1
ID: 75950
Updated by: php-bugs@lists.php.net
Reported by: xmlscript at gmail dot com
Summary: when zend.assertions=-1, and assert(sleep(5));
assertions is NOT zero-cost.
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Fedora 27
PHP Version: 7.2.2
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-02-03 11:14:52] cmb@php.net
I cannot reproduce this with PHP-7.4 even when using a shared
OPcache. Can you still reproduce with any of the actively
supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2018-02-15 18:05:22] xmlscript at gmail dot com
Reproduce this error need write real script file:
```script.php
<?php $a=1;assert($a++);echo $a;
```
shell# php -S localhost:88
shell# curl http://localhost:88/script.php
2
shell# php -f script.php
2
shell# echo '<?php $a=1;assert($a++);echo $a;' | php -d zend.assertions=-1
2
===================================================
php -a and php -r is OK:
shell# php -d zend.assertions=-1 -a
Interactive shell
php > $a=1;assert($a++);echo $a;
1
shell# php -d zend.assertions=-1 -r '$a=1;assert($a++);echo $a;'
1
------------------------------------------------------------------------
[2018-02-15 17:04:16] xmlscript at gmail dot com
@pslacerda
<?php
assert_options(ASSERT_ACTIVE, false);
$var = 1; // The expectation is always equal to 1, When zend.assertions=-1 and assert.active=Off
assert('$var++');
echo $var; // return 1, good.
assert($var++);
echo $var; // return 2, No! It should be 1
assert('$var++');
echo $var; // 2
assert($var++);
echo $var; // 3
?>
output: 1223
EXPECT: 1111
------------------------------------------------------------------------
[2018-02-14 06:57:19] pslacerda+php at gmail dot com
I couldn't reproduce this error.
------------------------------------------------------------------------
[2018-02-11 08:43:32] xmlscript at gmail dot com
<?php
/**
* php-fpm 7.2.2
* zend.assertions = -1
*/
var_dump( ini_get('zend.assertions') ); // return -1
assert_options(ASSERT_ACTIVE, false);
assert( 'sleep(5)' ); //with string, assertion code will not be generated, and throwed
an "Deprecated: assert(): Calling assert() with a string argument is deprecated in ..."
assert( sleep(5) ); //really waited for 5 seconds, is NOT assertions zero-cost. :(
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75950
--
Edit this bug report at https://bugs.php.net/bug.php?id=75950&edit=1