]> granicus.if.org Git - php/commitdiff
Add test case for bug #25831
authorMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 25 Oct 2003 04:43:47 +0000 (04:43 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 25 Oct 2003 04:43:47 +0000 (04:43 +0000)
tests/lang/bug25831.phpt [new file with mode: 0644]

diff --git a/tests/lang/bug25831.phpt b/tests/lang/bug25831.phpt
new file mode 100644 (file)
index 0000000..f73930a
--- /dev/null
@@ -0,0 +1,40 @@
+--TEST--
+Bug #25831 (pass-by-reference malfunction on overloaded method call)
+--FILE--
+<?php 
+class no_problem  {
+       function pass_by_reference(&$ref)       {
+               $ref = "Pass by reference works";
+       }
+}
+
+class problem  { 
+       function pass_by_reference(&$ref)       {
+               $ref = "Pass by reference works";
+       }
+       // simple dummy call implementation..
+    function __call($method,$params,&$return) {
+               if ($method == get_class($this)) {
+                       return true;    
+        }
+               return false; // not found!
+       }
+}
+
+overload('problem');
+
+$good = &new no_problem;
+$bad = &new problem;
+
+$message = "Pass by reference does not work!";
+$good->pass_by_reference($message);
+print "$message\n";
+
+$message = "Pass by reference does not work!";
+$bad->pass_by_reference($message);
+print "$message\n";
+
+?>
+--EXPECT--
+Pass by reference works
+Pass by reference works