php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75711 php.ini documentation fails to mention zend.assertions
Submitted: 2017-12-20 13:16 UTC Modified: 2021-08-26 16:17 UTC
From: mikko dot rantalainen at peda dot net Assigned:
Status: Verified Package: PHP options/info functions
PHP Version: 7.0.26 OS: Ubuntu Linux 16.04 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mikko dot rantalainen at peda dot net
New email:
PHP Version: OS:

 

 [2017-12-20 13:16 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-26 16:17 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: PHP options/info functions
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC