Doc #71873 [Ver->Csd]: Warning:zend.assertions may be completely enabled or disabled only in php.ini
| From: | krakjoe@php.net | Date: | Mon, 28 Mar 2016 06:43:53 +0000 |
| Subject: | Doc #71873 [Ver->Csd]: Warning:zend.assertions may be completely enabled or disabled only in php.ini | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13356@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71873&edit=1
ID: 71873
Updated by: krakjoe@php.net
Reported by: ildar dot aim at gmail dot com
Summary: Warning:zend.assertions may be completely enabled or
disabled only in php.ini
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: *Configuration Issues
Operating System: *
PHP Version: 7.0.4
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2016-03-28 06:42:50] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&revision=338838
Log: Fix #71873: additional explanation for zend.assertions in ini.core
------------------------------------------------------------------------
[2016-03-23 14:52:58] cmb@php.net
> This is how it's supposed to work.
Oops! Of course. Actually, the error message makes that clear
("... completely ...").
> Please, do not break an ability to enable asserts from php code.
As Nikita pointed out, enabling assertions during runtime is
*impossible*, if zend.assertions = -1.
However, as the documentation isn't very clear about this issue,
I'm changing to doc bug.
------------------------------------------------------------------------
[2016-03-23 14:21:37] ildar dot aim at gmail dot com
Please, do not break an ability to enable asserts from php code.
In some case, developers do not have a write access to the php.ini file.
This old debug code does not work after upgrade to PHP7 without
//Enable assertions
if (defined('DEVELOPMENT_MODE')) {
// ini_set('zend.assertions', 1); // does not work without php.ini corrections
assert_options(ASSERT_ACTIVE, true);
assert_options(ASSERT_BAIL, false);
assert_options(ASSERT_WARNING, false);
assert_options(ASSERT_CALLBACK, 'func_assert_failure_handler');
} else {
assert_options(ASSERT_ACTIVE, false);
}
------------------------------------------------------------------------
[2016-03-23 12:56:23] nikic@php.net
This is how it's supposed to work. You can't change from or to a -1 assertion level at
runtime, because it controls compile-time behavior. If you want to retain the ability to change the
assertion level at runtime, you should be using zend.assertions=0 in your ini, instead of
zend.assertions=-1.
------------------------------------------------------------------------
[2016-03-23 12:51:23] cmb@php.net
Indeed, there is obviously a contradiction in the code:
<https://github.com/php/php-src/blob/php-7.0.5RC1/Zend/zend.c#L121>
vs.
<https://github.com/php/php-src/blob/php-7.0.5RC1/Zend/zend.c#L132>.
------------------------------------------------------------------------
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=71873
--
Edit this bug report at https://bugs.php.net/bug.php?id=71873&edit=1