xref: /PHP-8.4/ext/opcache/tests/bool_not_cv.phpt (revision e9f783fc)
1--TEST--
2$v = !$v/(bool)$v checks for undefined variables
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_cache_only=0
7--EXTENSIONS--
8opcache
9--FILE--
10<?php
11function undef_negation() {
12    echo "In undef_negation\n";
13    $v = !$v;
14    var_export($v);
15    echo "\n";
16}
17function undef_bool_cast() {
18    echo "In undef_bool_cast\n";
19    $v = (bool)$v;
20    var_export($v);
21    echo "\n";
22}
23undef_negation();
24undef_bool_cast();
25?>
26--EXPECTF--
27In undef_negation
28
29Warning: Undefined variable $v in %s on line 4
30true
31In undef_bool_cast
32
33Warning: Undefined variable $v in %s on line 10
34false
35