Bug #17708: argument passing problem

From: Date: Tue, 11 Jun 2002 16:47:18 +0000
Subject: Bug #17708: argument passing problem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10136@lists.php.net to get a copy of this message
From: tsullivan@nforce.com Operating system: FreeBSD 4.3 PHP version: 4.1.2 PHP Bug Type: Class/Object related Bug description: argument passing problem /****************** From phpinfo() ******************/ './configure' '--with-apxs=/usr/local/sbin/apxs' '--with-config-file-path=/usr/local/etc' '--enable-versioning' '--with-system-regex' '--disable-debug' '--enable-track-vars' '--without-gd' '--without-mysql' '--with-gd=/usr/local' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib' '--with-imap=/usr/local' '--with-mysql=/usr/local' '--with-ldap=/usr/local' '--prefix=/usr/local' 'i386--freebsd4.3' /*******************************************************/ The script is made up of several files. It doesn't produce a standard PHP error, rather the browser (IE5) says that the server sent an unrecognized response. The script executes fine if I comment out the line in question. Here is the requested URI: /*******************************************************/ <?php require_once("TsTestBoundObject.class.php"); session_start(); if ($HTTP_GET_VARS["reset"]==1) { session_destroy(); session_start(); } if (!is_object($_SESSION["tester"])) { $_SESSION["tester"]=& new TsTestBoundObject("Hello World!<br>\n"); $_SESSION["test2"]=& new TsTestBoundObject("Hello World!<br>\n"); } echo $_SESSION["tester"]->UOID; //WORKS FINE echo $_SESSION["test2"]->UOID; //WORKS FINE TOO $temp = $_SESSION["tester"]; //ALL GOOD $temp2 = $_SESSION["test2"]; //ALL GOOD //$temp->setRelation("isParentOf", $temp2, "isChildOf"); echo $temp->content; //WORKS FINE $temp->test("hello?", $temp2); ?> /***************** END REQUESTED URI ********************/ The third last line (which is commented out) was what originally caused the error. That led me to create a method called test() in the same base class as setRelation() (note that object $temp belongs to a derived class of the class in which i defined test() and setRelation(). When I implemented test() like below, I get the expected results: function test($something, &$c) { echo $something; echo $c->content; } This produced a normal result, the string I passed in the call followed by $c->content, which was set to "Hello world". However, as soon as I changed the method to resemble the prototype of the method that was originally messed up (setRelation()), I got a very weird result: function test($something, &$c, $somethin2="") { echo $something; echo $c->content; echo $somethin2; } In this scenario, I called the above method like this: $temp->test("Hello", $temp2); Which should have produced the SAME output. Instead, it only prints out $temp2->content ("Hello World") and acts as though the $something was non-existent. Calling it with the third argument explicitly listed in the call resulted in the same thing. This led me to the conclusion that because of the argument count mismatch combined with the interpreter's lack of knowledge about the mismatch, PHP generated some type of weird output that caused my browser to get confused. -- Edit bug report at http://bugs.php.net/?id=17708&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17708&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17708&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17708&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17708&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17708&r=support Expected behavior: http://bugs.php.net/fix.php?id=17708&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17708&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17708&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17708&r=globals

« previous php.bugs (#10136) next »