Re: Bug #1393: PHP mixes up function definitions in different include() files
| From: | Thies C. Arntzen | Date: | Sun, 09 May 1999 12:24:38 +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-5431@lists.php.net to get a copy of this message | ||
hi, i have a similar problem, which i think is related....
if you set error_reorting to 15 and you have "deep" include hirachies php
(latest version) will report unitialized variables at points where it's
just not true...
i was just not able to create a "small" test-case for that (to send to
the list).... but maybe one of the "core-guys" could have a look at this
one, as (in my opinion) there's something wrong with nested includes!!!
regards,
tc
On 9 May 1999 Jens__26@yahoo.com wrote:
> From: Jens__26@yahoo.com
> Operating system: Windows 98
> PHP version: 3.0.7
> PHP Bug Type: Reproduceable crash
> Bug description: PHP mixes up function definitions in different include() files
>
> 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 signatures 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
>
>
>
> ------BUG REPORT----------------------------------------------------------------
> Classification: Reproducable Crash, Language related
> Related to: Parameters passed by reference, include()
> Workaround: Do not use Parameters passed by reference
> --Platform information:--
> PHP Version 3.0.6 (Win32, binary Distribution)
> OS: Windows 98
> Server: Apache 1.3.4 (Win32)
> Database: MySQL Shareware (Win32) Ver 9.13 Distrib 3.21.29a-gamma, for Win95 (i586)
> Hardware: Pentium MMX-233, 64 MB RAM
> --------------------------------------------------------------------------------
>
>
> The example for reproducing the bug consists of 5 files:
> "crash.php" (The main file, load this into a browser)
> "bricks.inc", "design.inc", "utility.inc", "dbdef.inc"
>
>
> --------------------------------------------------------------------------------
> START of Code files
> --------------------------------------------------------------------------------
>
> --------------------------------------------------------------------------------
> START of File "crash.php"
> --------------------------------------------------------------------------------
> <?php
>
> include("./dbdef.inc");
> include("./utility.inc");
> include("./design.inc");
> include("./bricks.inc");
>
> print(buildSuchUserDataTable("hallo", false, 0));
>
> ?>
> --------------------------------------------------------------------------------
> END of File "crash.php"
> --------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> START of File "bricks.inc"
> --------------------------------------------------------------------------------
> <?php
>
> if (!isset($bricks_inc)){
>
> $bricks_inc = true;
>
> include("./dbdef.inc");
> include("./utility.inc");
> include("./design.inc");
>
> function buildSuchUserDataTable($userKennung, $useDatabase = true,
> $userData = 0, $buildOnlyRows = false, $colspanLeft = 1, $colspanRight = 1,
> $databaseLink = 0){
> }
>
> }
>
> ?>
> --------------------------------------------------------------------------------
> END of File "bricks.inc"
> --------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> START of File "design.inc"
> --------------------------------------------------------------------------------
> <?php
>
> if (!isset($design_inc)){
>
> $design_inc = true;
>
> }
>
> ?>
> --------------------------------------------------------------------------------
> END of File "design.inc"
> --------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> START of File "utility.inc"
> --------------------------------------------------------------------------------
> <?php
>
> if (!isset($utility_inc)){
>
> $utility_inc = true;
>
>
> function mkValid(&$variable, $default = "", $assignIfEmpty = false){
> if (!isset($variable)) $variable = $default;
> else if ($assignIfEmpty) {
> if ($variable == "") $variable = $default;
> }
> }
>
> }
>
> ?>
> --------------------------------------------------------------------------------
> END of File "utility.inc"
> --------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> START of File "dbdef.inc"
> --------------------------------------------------------------------------------
> <?php
>
> if (!isset($dbdef_inc)){
>
> $dbdef_inc = true;
>
> }
>
> ?>
> --------------------------------------------------------------------------------
> END of File "dbdef.inc"
> --------------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------------
> END of Code files
> --------------------------------------------------------------------------------
>
>
> The example will NOT produce a Windows exception. I encountered this
> exception with the original code, which passed a variable, not a constant.
> I think this case is of minor importance, so I only post this message.
>
> -----START of text of the Windows exception message:-----
> PHP verursachte einen Fehler durch eine ungültige Seite
> in Modul KERNEL32.DLL bei 0177:bff7b983.
> Register:
> EAX=00000021 CS=0177 EIP=bff7b983 EFLGS=00010206
> EBX=00000000 SS=017f ESP=006bfda8 EBP=006bfdb8
> ECX=0046bd30 DS=017f ESI=013296f0 FS=3a47
> EDX=bffc9490 ES=017f EDI=00000000 GS=0000
> Bytes bei CS:EIP:
> 80 3e 04 74 0f 33 c0 50 50 50 68 05 00 00 c0 e8
> Stapelwerte:
> 0046c460 00442233 013296f0 00000005 006bfe38 0043e169 00000021 0044d638 00000005 0046bd50
> 00000001 00453024 0043de61 8165a618 0043de0b 0045301c
> -----END of text of the Windows exception message-----
>
>
> --
> PHP Development Mailing List http://www.php.net/
> To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
> For help: php-dev-help@lists.php.net
>
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net