mirror of
https://github.com/php/php-src.git
synced 2025-01-09 04:24:06 +08:00
40 lines
728 B
PHP
40 lines
728 B
PHP
--TEST--
|
|
assert() - set callback using ini_set()
|
|
--INI--
|
|
assert.active = 1
|
|
assert.warning = 0
|
|
assert.callback =
|
|
assert.bail = 0
|
|
assert.quiet_eval = 1
|
|
--FILE--
|
|
<?php
|
|
function a($file,$line,$myev)
|
|
{
|
|
echo "assertion failed - a - $line,\"$myev\"\n";
|
|
}
|
|
|
|
function b($file,$line,$myev)
|
|
{
|
|
echo "assertion failed - b - $line,\"$myev\"\n";
|
|
}
|
|
|
|
assert_options(ASSERT_ACTIVE,1);
|
|
assert_options(ASSERT_QUIET_EVAL,1);
|
|
assert_options(ASSERT_WARNING,0);
|
|
|
|
$a = 0;
|
|
|
|
assert_options(ASSERT_CALLBACK,"a");
|
|
assert('$a != 0');
|
|
|
|
/* Modify call back using ini_set() */
|
|
ini_set("assert.callback", "b");
|
|
assert('$a != 0');
|
|
|
|
?>
|
|
==DONE==
|
|
--EXPECTF--
|
|
assertion failed - a - %d,"$a != 0"
|
|
assertion failed - b - %d,"$a != 0"
|
|
==DONE==
|