xref: /PHP-8.3/Zend/tests/assert/expect_016.phpt (revision 3d4ff5ae)
1--TEST--
2test enable/disable assertions at runtime (assertions not completely disabled)
3--INI--
4zend.assertions=0
5--FILE--
6<?php
7ini_set("zend.assertions", 0);
8var_dump(assert(false));
9var_dump(assert(true));
10ini_set("zend.assertions", 1);
11try {
12    var_dump(assert(false));
13} catch (AssertionError $e) {
14    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
15}
16var_dump(assert(true));
17ini_set("zend.assertions", -1);
18?>
19--EXPECTF--
20bool(true)
21bool(true)
22assert(): assert(false) failed
23bool(true)
24
25Warning: zend.assertions may be completely enabled or disabled only in php.ini in %s on line %d
26