summaryrefslogtreecommitdiff
path: root/ext/opcache/tests/bool_not_cv.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache/tests/bool_not_cv.phpt')
-rw-r--r--ext/opcache/tests/bool_not_cv.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/opcache/tests/bool_not_cv.phpt b/ext/opcache/tests/bool_not_cv.phpt
new file mode 100644
index 0000000000..ed3cf83514
--- /dev/null
+++ b/ext/opcache/tests/bool_not_cv.phpt
@@ -0,0 +1,34 @@
+--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