From:             seregon at gmail dot com
Operating system: Neutral
PHP version:      5.4.4
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:Nested Includes

Description:
------------
Scenario: File A includes File B, which in turn includes File C.

Problematic: The way PHP currently handles relative file paths (and this
holds, from what I've seen, for include, require, file_get_contents, and
just about everything else; I'm reasonably sure it's PHP's general relative
file path handling I'm frustrated with) is by resolving everything with the
path of the ROOT calling script. Thus, if A & B are in the same
subdirectory, A can include B. If, however, A moves from the subdirectory,
then A cannot include B if C has any relative file paths. This is because C
will call them with A's path when A starts the chain of includes, and B's
path when B starts it. Since A & B are not in the same directory, this will
always fail for at least one of them.

Expected result:
----------------
I can't really make any sense of why it was done this way, and I haven't
found anything in the documentation mentioning it. If this supports another
worthwhile feature, then I'll gladly be educated. Further, I'm open to
suggestions to deal with it. However, as I've been dealing with this the
last few days, it's a very frustrating impediment to having a non-OO file
in a single location with handy functions in it. You have to copy the damn
thing all over the file system to have relative paths in it, which defeats
the whole point of it having relative paths.

To me, this should proceed rather like functions (since it's by its nature
procedural -- if File C was OO this would be moot). Function C's calls
should have a sort of "local scope" whereby relative paths and perhaps
other such things could be resolved, so that they can be used no matter
where they reside in the file system without having to hardcode absolute
paths (meaning they have to be updated when something else changes) or
duplicate them across the fs (meaning they can be thrown out of sync and
have to be updated multiple times).

Actual result:
--------------
as above

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

Reply via email to