From:             frank at procurios dot nl
Operating system: Windows
PHP version:      5.1.5
PHP Bug Type:     Scripting Engine problem
Bug description:  require_once() distinguishes backslashes from forward slashes

Description:
------------
When including a file, require_once() will make a destinction between
path/file strings containing forward slashes and backslashes. 

Reproduce code:
---------------
(example)
function __autoload($className){
    $basePath = 'C:/htdocs';
    $classPath= $basePath . '/classes';
    require_once($classPath . "/$className.class.php");
}

// Some function that doesn't resolves paths
function getPath($file){
   $path = realpath('./$file');
   return $path;
}   

// Autoload
$A = new Foo;

// Explicit require of class
require_once(getPath(Foo.class.php));
$B = new Foo;

Expected result:
----------------
One would expect the require_once to notice that Foo has already been
loaded and not include the file a second time.

Actual result:
--------------
Fatal error: Cannot redeclare class foo in c:\htdocs\classes\Foo.class.php
on line n

(or something like that)

Whatever the actual result, the file is loaded twice, as the slashes
produced by realpath are distinguished from the slashes used in the
defined __autoload() function. 

-- 
Edit bug report at http://bugs.php.net/?id=38579&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38579&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38579&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38579&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38579&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38579&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38579&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38579&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38579&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38579&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38579&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38579&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38579&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38579&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38579&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38579&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38579&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38579&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38579&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38579&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38579&r=mysqlcfg

Reply via email to