summaryrefslogtreecommitdiff
path: root/ext/standard/tests/assert/assert_error2.phpt
blob: 8770391527f192b3f8f34bb9101c44a21c270db5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
assert() - basic - Test that bailout works
--INI--
assert.active = 1
assert.warning = 1
assert.callback = f1
assert.quiet_eval = 1
assert.bail = 0
error_reporting = -1
display_errors = 1
--FILE--
<?php
function f1($script, $line, $message, $user_message)
{
	echo "f1 called\n";
}

//bail out on error
var_dump($rao = assert_options(ASSERT_BAIL, 1));
var_dump($r2 = assert("0 != 0"));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)

Warning: assert(): Assertion "0 != 0" failed in %s on line 9

Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2
Stack trace:
#0 [internal function]: f1('%s', 9, '0 != 0')
#1 %sassert_error2.php(9): assert('0 != 0')
#2 {main}
  thrown in %sassert_error2.php on line 2