]> granicus.if.org Git - php/commitdiff
- New tests
authorFelipe Pena <felipe@php.net>
Fri, 9 May 2008 14:17:42 +0000 (14:17 +0000)
committerFelipe Pena <felipe@php.net>
Fri, 9 May 2008 14:17:42 +0000 (14:17 +0000)
Zend/tests/isset_001.phpt [new file with mode: 0644]
Zend/tests/isset_002.phpt [new file with mode: 0644]
Zend/tests/isset_003.phpt [new file with mode: 0644]

diff --git a/Zend/tests/isset_001.phpt b/Zend/tests/isset_001.phpt
new file mode 100644 (file)
index 0000000..340b237
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+Testing isset and unset with variable variables
+--FILE--
+<?php
+
+print "- isset ---\n";
+
+$var_name = 'unexisting';
+
+if (isset($$var_name)) {
+       print "error\n";
+}
+
+$test = 'var_name';
+
+if (isset($$$test)) {
+       print "error\n";
+}
+
+print "- unset ---\n";
+
+unset($$var_name);
+
+unset($$$test);
+
+print "done\n";
+
+?>
+--EXPECT--
+- isset ---
+- unset ---
+done
diff --git a/Zend/tests/isset_002.phpt b/Zend/tests/isset_002.phpt
new file mode 100644 (file)
index 0000000..8dd3acc
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+Testing isset with several undefined variables as argument
+--FILE--
+<?php
+
+var_dump(isset($a, ${$b}, $$c, $$$$d, $e[$f->g]->d));
+
+?>
+--EXPECT--
+bool(false)
diff --git a/Zend/tests/isset_003.phpt b/Zend/tests/isset_003.phpt
new file mode 100644 (file)
index 0000000..f8680fa
--- /dev/null
@@ -0,0 +1,34 @@
+--TEST--
+Testing isset accessing undefined array itens and properties
+--FILE--
+<?php
+
+$a = 'foo';
+$b =& $a;
+
+var_dump(isset($b));
+
+var_dump(isset($a[0], $b[1]));
+
+var_dump(isset($a[0]->a));
+
+var_dump(isset($c[0][1][2]->a->b->c->d));
+
+var_dump(isset(${$a}->{$b->$c[$d]}));
+
+var_dump(isset($GLOBALS));
+
+var_dump(isset($GLOBALS[1]));
+
+var_dump(isset($GLOBALS[1]->$GLOBALS));
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)