blob: ac84a158f902c00be3e2f4992b6c78f27991f5c6 (
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
33
34
35
36
|
--TEST--
assert() - basic - check switch on warnings using assert_options.
--INI--
assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
echo "f1 called\n";
}
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 1));
$sa = "0 != 0";
var_dump($r2=assert($sa));
$sa = "0 == 0";
var_dump($r2=assert($sa));
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 0));
--EXPECTF--
int(0)
Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
bool(false)
Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
int(1)
|