|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
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
From manual page:
... 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

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("", 1); assert(false); ?>

or directly from command line:
php -d zend.assertions=-1  -r 'ini_set("", 1); assert(false);'
php -d zend.assertions=1  -r 'ini_set("", 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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-26 16:17 UTC]
-Status: Open +Status: Verified -Package: Documentation problem +Package: PHP options/info functions
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 20:01:32 2024 UTC