]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
authorSVN Migration <svn@php.net>
Sat, 15 Feb 2003 15:15:15 +0000 (15:15 +0000)
committerSVN Migration <svn@php.net>
Sat, 15 Feb 2003 15:15:15 +0000 (15:15 +0000)
ext/mysqli/tests/045.phpt [new file with mode: 0644]
tests/lang/bug22231.phpt [new file with mode: 0644]

diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt
new file mode 100644 (file)
index 0000000..5ca0f2a
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+mysqli_bind_result (SHOW)
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
+
+       mysqli_execute($stmt);
+       mysqli_bind_result($stmt, &$c1, &$c2);  
+       mysqli_fetch($stmt);
+       mysqli_stmt_close($stmt);       
+       $test = array ($c1,$c2);
+
+       var_dump($test);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(4) "port"
+  [1]=>
+  string(4) "3306"
+}
diff --git a/tests/lang/bug22231.phpt b/tests/lang/bug22231.phpt
new file mode 100644 (file)
index 0000000..0d4d19d
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+Bug #22231 (segfault when returning a global variable by reference)
+--FILE--
+<?php
+class foo {
+    var $fubar = 'fubar';
+}
+
+function &foo(){
+    $GLOBALS['foo'] = &new foo();
+    return $GLOBALS['foo'];
+}
+$bar = &foo();
+var_dump($bar);
+var_dump($bar->fubar);
+unset($bar);
+$bar = &foo();
+var_dump($bar->fubar);
+
+$foo = &foo();
+var_dump($foo);
+var_dump($foo->fubar);
+unset($foo);
+$foo = &foo();
+var_dump($foo->fubar);
+?>
+--EXPECT--
+object(foo)(1) {
+  ["fubar"]=>
+  string(5) "fubar"
+}
+string(5) "fubar"
+string(5) "fubar"
+object(foo)(1) {
+  ["fubar"]=>
+  string(5) "fubar"
+}
+string(5) "fubar"
+string(5) "fubar"