xref: /php-src/Zend/tests/gh16954.phpt (revision 5a482a13)
1--TEST--
2GH-16954: Enum to bool comparison is inconsistent
3--FILE--
4<?php
5
6enum E {
7    case C;
8}
9
10$true = true;
11$false = false;
12
13var_dump(E::C == true);
14var_dump(E::C == $true);
15var_dump(true == E::C);
16var_dump($true == E::C);
17
18var_dump(E::C != true);
19var_dump(E::C != $true);
20var_dump(true != E::C);
21var_dump($true != E::C);
22
23var_dump(E::C == false);
24var_dump(E::C == $false);
25var_dump(false == E::C);
26var_dump($false == E::C);
27
28var_dump(E::C != false);
29var_dump(E::C != $false);
30var_dump(false != E::C);
31var_dump($false != E::C);
32
33?>
34--EXPECT--
35bool(true)
36bool(true)
37bool(true)
38bool(true)
39bool(false)
40bool(false)
41bool(false)
42bool(false)
43bool(false)
44bool(false)
45bool(false)
46bool(false)
47bool(true)
48bool(true)
49bool(true)
50bool(true)
51