From: [EMAIL PROTECTED]
Operating system: WinXP Pro SP1
PHP version: 4.3.3RC3
PHP Bug Type: Scripting Engine problem
Bug description: nested require() not working, no error given
Description:
------------
This is kinda hard to explain, but here goes.
I have this directory structure:
/
/htdocs
/includes
I have a file in /htdocs (index.php) which includes a file
(base.class.php) in /includes which in turn includes another file
(config.inc.php) in /includes.
/includes is in my include_path and so I'm just using:
require('file');
Now, the problem seems to be that the variable in config.inc.php (its just
a single array of config options) is not visible in base.class.php unless
I use a relative path (require('../includes/config.inc.php');)
As I say there is no problem when using the relative path and no Fatal
Error if I'm not, just the Notice.
I haven't had time to come up with a test case (sorry) but if this is
indeed a proper bug I felt you might like to fix it before 4.3.3 final is
out. I can also confirm this behavior in a snap (4.3.x 200308050430) and
4.3.2 final.
I will come up with a test case and also test on FBSD asap (next couple of
days is my earliest)
Note: there seems to be no problems when there is no nested inclusion
involved (i.e. index.php requires footer.inc.php and can access its vars)
- Davey
Reproduce code:
---------------
class base {
function base() {
require('config.inc.php');
$this->_CONFIG = $_CONFIG;
}
}
Expected result:
----------------
$_CONFIG should be assigned to $this->config
Actual result:
--------------
Notice: Undefined variable: _CONFIG
--
Edit bug report at http://bugs.php.net/?id=24992&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24992&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24992&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24992&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24992&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24992&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24992&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24992&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24992&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24992&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24992&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24992&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24992&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24992&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24992&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24992&r=gnused