]> granicus.if.org Git - php/commitdiff
Test case for bug #22836.
authorIlia Alshanetsky <iliaa@php.net>
Tue, 29 Jul 2003 17:56:50 +0000 (17:56 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 29 Jul 2003 17:56:50 +0000 (17:56 +0000)
Zend/tests/bug22836.phpt [new file with mode: 0644]

diff --git a/Zend/tests/bug22836.phpt b/Zend/tests/bug22836.phpt
new file mode 100644 (file)
index 0000000..14c9e9f
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #22836 (returning references to NULL)
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
+--FILE--
+<?php
+function &f()
+{
+       $x = "foo";
+        var_dump($x);
+        print "'$x'\n";
+        return ($a);
+}
+for ($i = 0; $i < 8; $i++) {
+       $h =& f();
+}
+?>
+--EXPECTF--
+string(3) "foo"
+'foo'
+
+Notice: Undefined variable:  a in %s on line %d
+
+Fatal error: Only variables or references can be returned by reference in %s on line %d