Bug #70241 [Nab->ReO]: Skipped assertions affect Generator returns
| From: | bwoebi@php.net | Date: | Tue, 11 Aug 2015 18:16:20 +0000 |
| Subject: | Bug #70241 [Nab->ReO]: Skipped assertions affect Generator returns | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195136@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70241&edit=1
ID: 70241
Updated by: bwoebi@php.net
Reported by: me at kelunik dot com
Summary: Skipped assertions affect Generator returns
-Status: Not a bug
+Status: Re-Opened
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.0.0beta3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Precisely, it means not producing any code. "-1 - don't generate any code (zero-cost,
production mode)" from the RFC.
It doesn't mean ignore all the side-effects caused by the content of assert(). It just means
ignoring the code generated by it.
So, the reporter is right. Either it's a mistake in the RFC or a bug.
Previous Comments:
------------------------------------------------------------------------
[2015-08-11 18:07:58] cmb@php.net
zend.assertions=-1 means don't produce any code, so the script
behaves as if there was no assert statement.
------------------------------------------------------------------------
[2015-08-11 17:58:28] me at kelunik dot com
Description:
------------
Assertion configuration can change code behavior:
php -d zend.assertions=1 test.php -> Generator
php -d zend.assertions=-1 test.php -> bool(true)
Test script:
---------------
<?php
function foo() {
assert(yield 42);
return true;
}
var_dump(foo());
Expected result:
----------------
php -d zend.assertions=1 test.php -> Generator
php -d zend.assertions=-1 test.php -> Generator
Actual result:
--------------
php -d zend.assertions=1 test.php -> Generator
php -d zend.assertions=-1 test.php -> bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70241&edit=1