ID:               24671
 Updated by:       [EMAIL PROTECTED]
 Reported By:      stefan dot priebsch at e-novative dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Win2K, WinXP
 PHP Version:      4.3.2
 New Comment:

Not a bug, as this is supposed to work on Unices like this.


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

[2003-07-16 02:45:55] stefan dot priebsch at e-novative dot de

Description:
------------
When the same file is include_once'd multiple times, but with a
different case, PHP does not recognize that actually the same file is
included multiple times. This can lead to "cannot redefine function
(resp. class)" errors.

>From looking at the array returned by get_included_files, it seems that
PHP handles the list in a case-sensitive way, which obviously is wrong
since Win path and file names are not case sensitive.

To reproduce the error, create main.php and include.php using the code
below. The example produces a "cannot redefine" error, which is
unexpected behaviour.

When commenting out the function definition and running the example
again, one can see that the included file name appears twice in the
list, but with different case.

Reproduce code:
---------------
main.php:

  print 'main ';
  
  include_once ('include.php');
  print_r (get_included_files ());
  
  include_once ('Include.php');
  print_r (get_included_files ());

include.php:

  print 'included file ';

  function included_fn ()
  {
    print 'included fn ';
  } 


Expected result:
----------------
main included file Array ( [0] => main.php [1] => include.php )
included file 

[full paths removed for clarity]

Actual result:
--------------
main included file Array ( [0] => main.php [1] => include.php )
included file 
Fatal error: Cannot redeclare included_fn() (previously declared in
include.php:7) in Include.php on line 5

[full paths removed for clarity]


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


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

Reply via email to