From: guillermo dot freire at gmail dot com
Operating system: Windows XP SP2
PHP version: 5.2.4RC1
PHP Bug Type: Feature/Change Request
Bug description: include(): script directory first!
Description:
------------
I'd like common library writing were as clean as possible regarding
includes. The problem is that "files for including are first looked in
include_path relative to the current working directory and then in the
directory of the current script", and not the other way round, thus forcing
the programmer to write a dirty absolute path, which attemtpts against
maintainability.
A possible solution would be that if the include argument starts with a
dot (.), then maintain current behaviour, else, look in script's directory
first.
Reproduce code:
---------------
File /test.php (run this):
<?php
include('lib/test2.php');
echo "/test.php<br>";
?>
---------------
File /lib/test2.php:
<?php
include('test.php'); //Intends to include /lib/test but includes
/test.php
echo "/lib/test2.php<br>";
?>
---------------
File /lib/test.php:
<?php
echo "/lib/test.php<br>";
?>
Expected result:
----------------
/lib/test.php
/lib/test2.php
/test.php
Actual result:
--------------
Fatal error: Maximum function nesting level of '100' reached, aborting!
/lib/test2.php on line 2
--
Edit bug report at http://bugs.php.net/?id=42263&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42263&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42263&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42263&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42263&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42263&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42263&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42263&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42263&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42263&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42263&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42263&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42263&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42263&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42263&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42263&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42263&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42263&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42263&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42263&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42263&r=mysqlcfg