Doc #75711 [Opn->Ver]: php.ini documentation fails to mention zend.assertions
Edit report at https://bugs.php.net/bug.php?id=75711&edit=1
ID: 75711
Updated by: cmb@php.net
Reported by: mikko dot rantalainen at peda dot net
Summary: php.ini documentation fails to mention
zend.assertions
-Status: Open
+Status: Verified
Type: Documentation Problem
-Package: Documentation problem
+Package: PHP options/info functions
Operating System: Ubuntu Linux 16.04 LTS
PHP Version: 7.0.26
Block user comment: N
Private report: N
New Comment:
See also <https://wiki.php.net/rfc/expectations#phpini>.
Previous Comments:
------------------------------------------------------------------------
[2017-12-20 13:16:16] mikko dot rantalainen at peda dot net
Description:
------------
---
From manual page: http://www.php.net/info.configuration
---
...
assert.active boolean
Enable assert() evaluation.
...
This is no longer true. PHP 7 requires setting zend.assertions=1 in php.ini or assert() will never
do nothing.
The above referenced runtime configuration should include following from http://php.net/assert:
PHP 7 configuration directives for assert()
Directive Default value Possible values
zend.assertions (default 1)
1: generate and execute code (development mode)
0: generate code but jump around it at runtime
-1: do not generate code (production mode)
assert.exception (default 0)
1: throw when the assertion fails, either by throwing the object provided as the exception or by
throwing a new AssertionError object if exception wasn't provided
0: use or generate a Throwable as described above, but only generate a warning based on that object
rather than throwing it (compatible with PHP 5 behaviour)
Test script:
---------------
<?php ini_set("assert.active", 1); assert(false); ?>
or directly from command line:
php -d zend.assertions=-1 -r 'ini_set("assert.active", 1); assert(false);'
vs
php -d zend.assertions=1 -r 'ini_set("assert.active", 1); assert(false);'
Expected result:
----------------
Above test script should display a warning or uncatched exception about failed assert. Instead, with
default PHP 7 configuration, nothing will happen.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75711&edit=1
Thread (2 messages)