Re: Bug #1393: PHP mixes up function definitions in different include() files

From: Date: Mon, 10 May 1999 13:51:17 +0000
Subject: Re: Bug #1393: PHP mixes up function definitions in different include() files
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-5476@lists.php.net to get a copy of this message
hi, i've reproduced the bug reported by "Jens Fransson" - and i would really like it if one of the parser guys (zeev, andi??) could have a look at it.... as i belive that this has cause me headache in the past (but i was unsuccessful creating a test-case).... tc his mail: Hi folks! During my PHP development I encountered the bug described below. It looks like a problem in the interpreter. I made a little source example which reproduces the problem. It is related to function parameters which are passed by reference, e.g. function foo(&$a){ $a = 10; } Combined with include() statements, PHP seems to mix up the Parameter signatus mail: res of functions defined in different files. In some weird cases, it tells that the call (e.g. bar(3) ) of another function, e.g. function bar($b){ return $b + 10; } is not possible, because '3' would not be a reference. This is the good case. It becomes even more weird when passing a reference, e.g. bar($x). Then PHP will probably crash with a page fault. I found out the following conditions for this bug to occur (not necessarily complete nor totally correct): 1. 4 or more files are included via include(). 2. At least 2 files perform a cyclic include with each other. 3. At least 2 files define different functions, one with a parameter passed by reference, the other without. 4. Another file calls the function without parameters passed by reference. This must not always happen, but in my example (see below), it "works". The example will produce the following error message: "Warning: Cannot pass expression as argument 1 by reference in c:\program\internet\apache\server1.3.4\htdocs\test\crash.php on line 8" My actual workaround is not to use parameters passed by reference. Perhaps one of you hardcore PHP developers wants to get into this? Let me know if you find out something! Regards, Jens Fransson. E-Mail: jens__26@yahoo.com

« previous php.dev (#5476) next »