Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

assert.active INI setting is deprecated

Description

assert.active is a legacy INI directive that dates back to the pre-PHP 7 implementation of assert(), where assertions could be toggled on or off at runtime through several assert.* INI settings.

Since PHP 7, assertion behavior is primarily controlled by the zend.assertions directive, which supports three modes: 1 (generate and execute code, development mode), 0 (generate code, but skip execution at runtime), and -1 (do not generate code, production mode). assert.active became redundant, only affecting whether assert() calls are executed at all, and is now deprecated.

The deprecation notice is triggered whenever assert.active is set to a falsy value, either in php.ini or through ini_set().

Example

<?php

ini_set('assert.active', '0');

?>

Alternatives

  • Use the zend.assertions directive to control whether assertions are compiled and executed.
  • Remove ini_set()/ini_get() calls involving assert.active from the code.

In more recent PHP versions, this error message is now :ref:assert.bail-ini-setting-is-deprecated.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See assert