From:             john at castlecomm dot com
Operating system: ALL
PHP version:      4.4.2
PHP Bug Type:     Reproducible crash
Bug description:  Include and Require do not work properly after ini_set 
include_path

Description:
------------
Including a file using a relative path after INI SETTING the include_path
does not work.

Setting the include_path works, but but PHP does not use it correctly.

This is a major flaw in the include logic.

A full detailed example is listed under the "Reproduce code" section.

Please fix this as soon as possible, as it is having drastic negative
affects on my software with your latest version.

Also, your "CAPTCHA" picture needs to be larger...the "R" in my code gets
cut off and goes off the screen.  I could barely make it out.

Reproduce code:
---------------
[john@(PROTECTED) error]$ cat mainfile.php 
<?
$include_path = ini_get('include_path');

$include_path .= ':./ws:'; //this doesn't even work with an absolute path

ini_set('include_path', $include_path);

include 'ws/wsfile.php';

print "Hi!  I'm mainfile!\n";
?>
[john@(PROTECTED) error]$ cat ws/wsfile.php 
<?
include_once '../inc/incfile.php';

print "Hi!  I'm wsfile!\n";
?>
[john@(PROTECTED) error]$ cat inc/incfile.php 
<?
print "Hi!  I'm incfile!\n";
?>
[john@(PROTECTED) error]$ php mainfile.php 

Warning: main(../inc/incfile.php): failed to open stream: No such file or
directory in /(PROTECTED)/john/error/ws/wsfile.php on line 2

Warning: main(): Failed opening '../inc/incfile.php' for inclusion
(include_path='.:/usr/local/lib/php:./ws:') in
/(PROTECTED)/john/error/ws/wsfile.php on line 2
Hi!  I'm wsfile!
Hi!  I'm mainfile!

Expected result:
----------------
The INI SET works, but include_once, as well as the others, do not work
correctly.  It can't find the relatively included file...even though the
INI include_path is set.

The code should work because the include path has been set properly.  Even
the error output shows the right include path, but the include_once
directive just fails.

This is a major error and is having really bad results on my software.

Please fix this asap!

Actual result:
--------------
[john@(PROTECTED) error]$ php mainfile.php 

Warning: main(../inc/incfile.php): failed to open stream: No such file or
directory in /(PROTECTED)/john/error/ws/wsfile.php on line 2

Warning: main(): Failed opening '../inc/incfile.php' for inclusion
(include_path='.:/usr/local/lib/php:./ws:') in
/(PROTECTED)/john/error/ws/wsfile.php on line 2
Hi!  I'm wsfile!
Hi!  I'm mainfile!

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

Reply via email to