From:             l dot mauri at neopost dot com
Operating system: Solaris 10
PHP version:      5.2.11
PHP Bug Type:     Filesystem function related
Bug description:  require_once include twice the same file

Description:
------------
Hello everyone,

I have a problem with my installation of PHP 5.2.11 (please see my
configuration below)

I'm using require_once to include twice the same file. In one case I'm
including the file based on its relative path and in other case I'm
including it with its absolute path.

When I use the php client in command line, it works fine. I only have the
problem using Apache server.

I figured out that realpath can't resolve the relative path:
<?php
   print realpath("./file2.php") . "\n";                  ==> FALSE
   print realpath("/absolute/path/to/file2.php') . "\n";  ==> /
absolute/path/to/file2.php
?> 

Thank you in advance

----------------------------------------------------------------
Configuration:
SunOS devs0004 5.10 Generic_137137-09 sun4u sparc SUNW,Sun-Fire-V240
64-bit sparcv9 kernel modules

PHP 5.2.11
Configure Command =>  './configure'  '--with-libxml-dir=/usr/local' '--
with-mysql=/usr/local/mysql5136/' '--enable-track-vars' '--enable-
libgcc' '--enable-trans-sid' '--enable-ftp' '--enable-pcntl' '--enable-
sockets' '--enable-soap' '--with-apxs=/usr/apache/bin/apxs' '--with-
zlib-dir=/usr/local/lib' '--with-pdo-mysql=/usr/local/mysql5136' '--
with-mcrypt=/usr/local/bin' '--enable-debug'

$ file /usr/local/bin/php
/usr/local/bin/php: ELF 32-bit MSB executable SPARC Version 1, dynamically
linked, not stripped

$ file /usr/apache/libexec/libphp5.so
/usr/apache/libexec/libphp5.so: ELF 32-bit MSB dynamic lib SPARC Version
1, dynamically linked, not stripped

Apache 1.3.41


Reproduce code:
---------------
file1.php
<?php

require_once('./file2.php');
require_once('/absolute/path/to/file2.php');

$a = new A();
?>
----------------------------------------------------------------
file2.php
<?php
class A
{
    public function foo() { echo 'Foo'; }
}
?>

Expected result:
----------------
The second call to require_once does not include the file.

Actual result:
--------------
PHP raise a Fatal Error : "Fatal error: Cannot redeclare class"

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

Reply via email to