ID:               27891
 Comment by:       kj at legalizer dot dk
 Reported By:      faraco dot phpbugs at mailnull dot com
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows NT4 SP6
 PHP Version:      5CVS-2004-04-15
 New Comment:

What if you turn off ISAPI caching?


Previous Comments:
------------------------------------------------------------------------

[2004-04-06 15:21:29] faraco dot phpbugs at mailnull dot com

Here is the confirmation of the bug. Changing index.php to:
<?
echo realpath("../lib/functions.php")."<br>";
echo realpath("lib/functions.php");
?>

Expected result is:
E:\docroot\lib\functions.php
E:\docroot\subroot\lib\functions.php

While actual result is:
E:\docroot\lib\functions.php
E:\docroot\lib\functions.php

------------------------------------------------------------------------

[2004-04-06 15:10:20] faraco dot phpbugs at mailnull dot com

The same script runs perfectly on PHP 4.3.4.

------------------------------------------------------------------------

[2004-04-06 14:55:53] faraco dot phpbugs at mailnull dot com

Sorry. I mistyped the Actual Result. The correct message is:
PHP Fatal error: Cannot redeclare anyfunction() (previously declared
in
E:\docroot\lib\functions.php:4) in E:\docroot\lib\functions.php on
line 7

------------------------------------------------------------------------

[2004-04-06 14:54:18] faraco dot phpbugs at mailnull dot com

Description:
------------
I have the following file structure (folders in uppercase for better
understanding):

DOCROOT
 |
 +- LIB
 |   |
 |   +- functions.php
 |
 +- SUBROOT
     |
     +- index.php
     |
     +- LIB
         |
         +- functions.php


The 'index.php' file uses the require() function to include both
'functions.php' files (that have different contents). When running
'index.php', a "Cannot redeclare function" error occurs.
Pay attention at the error message: the compiler says that the same
function is redeclared in the same file on different lines!

Reproduce code:
---------------
DOC_ROOT/LIB/functions.php
--------------------------
<?
echo "Here is DOCROOT\\LIB\\functions.php<br>";

function anyfunction($param)
{
        return $param;
}
?>


DOCROOT/SUBROOT/LIB/functions.php
---------------------------------
<?
echo "Here is DOCROOT\\SUBROOT\\LIB\\functions.php<br>";
?>


DOC_ROOT/SUBROOT/LIB/index.php
------------------------------
<?
require("../lib/functions.php");
require("lib/functions.php");

echo anyfunction("Hello World!");
?>


Expected result:
----------------
Here is DOCROOT\LIB\functions.php
Here is DOCROOT\SUBROOT\LIB\functions.php
Hello World!


Actual result:
--------------
Here is DOCROOT\LIB\functions.php
PHP Fatal error: Cannot redeclare anyfunction() (previously declared in
C:\doc_root\lib\functions.php:4) in E:\doc_root\lib\functions.php on
line 7 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27891&edit=1

Reply via email to