|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-03-21 17:25 UTC] ildar dot aim at gmail dot com
Description: ------------ According to http://php.net/manual/en/ini.core.php zend.assertions is PHP_INI_ALL In spite of this fact my script generates php warninig "Warning: zend.assertions may be completely enabled or disabled only in php.ini" ------------- My info aim-server[~/tmp]$ php -i |grep -i assert zend.assertions => -1 => -1 assert.active => 1 => 1 assert.bail => 0 => 0 assert.callback => no value => no value assert.exception => 0 => 0 assert.quiet_eval => 0 => 0 assert.warning => 1 => 1 aim-server[~/tmp]$ aim-server[~/tmp]$ php -v PHP 7.0.4 (cli) (built: Mar 5 2016 09:28:27) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans aim-server[~/tmp]$ Test script: --------------- error_reporting(-1); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set('zend.assertions', 1); var_dump('end');die; Expected result: ---------------- string(3) "end" Actual result: -------------- PHP Warning: zend.assertions may be completely enabled or disabled only in php.ini in /home/aim/tmp/home.php on line 46 PHP Stack trace: PHP 1. {main}() /home/aim/tmp/home.php:0 PHP 2. ini_set() /home/aim/tmp/home.php:46 Warning: zend.assertions may be completely enabled or disabled only in php.ini in /home/aim/tmp/home.php on line 46 Call Stack: 0.0002 399768 1. {main}() /home/aim/tmp/home.php:0 0.0002 400280 2. ini_set() /home/aim/tmp/home.php:46 /home/aim/tmp/home.php:47: string(3) "end" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
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); }> 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.