mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
a2c41c0ea6
And `$x = !$x` Noticed while working on GH-4912 The included test would not emit undefined variable errors in php 8.0 with opcache enabled. The command used: ``` php -d zend_extension=opcache.so --no-php-ini -d error_reporting=E_ALL \ -d opcache.file_cache= -d opcache.enable_cli=1 test.php ```
35 lines
617 B
PHP
35 lines
617 B
PHP
--TEST--
|
|
$v = !$v/(bool)$v checks for undefined variables
|
|
--INI--
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.file_cache_only=0
|
|
--SKIPIF--
|
|
<?php require_once('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
function undef_negation() {
|
|
echo "In undef_negation\n";
|
|
$v = !$v;
|
|
var_export($v);
|
|
echo "\n";
|
|
}
|
|
function undef_bool_cast() {
|
|
echo "In undef_bool_cast\n";
|
|
$v = (bool)$v;
|
|
var_export($v);
|
|
echo "\n";
|
|
}
|
|
undef_negation();
|
|
undef_bool_cast();
|
|
?>
|
|
--EXPECTF--
|
|
In undef_negation
|
|
|
|
Notice: Undefined variable: v in %s on line 4
|
|
true
|
|
In undef_bool_cast
|
|
|
|
Notice: Undefined variable: v in %s on line 10
|
|
false
|