Bug #17551 Updated: PHP4.10 and PHP4.20 includes different files when calling include_once()
| From: | ulysses at mail dot fitan dot com dot tw | Date: | Mon, 03 Jun 2002 03:15:43 +0000 |
| Subject: | Bug #17551 Updated: PHP4.10 and PHP4.20 includes different files when calling include_once() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9268@lists.php.net to get a copy of this message | ||
ID: 17551
Updated by: ulysses@mail.fitan.com.tw
Reported By: ulysses@mail.fitan.com.tw
-Status: Bogus
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 2000 (IIS5.0)
PHP Version: 4.2.0
New Comment:
I am not playing with PHP. It my job and I am developing a
Stock-MRP-Accounting system for my client and I have
problems switching from 4.10 to 4.20. Maybe I should
describe the real situation to you.
I have these files:
c:/inetpub/wwwroot/stock/stock_amend.php
c:/inetpub/wwwroot/stock/edit/stock_amend.approve.php
c:/inetpub/wwwroot/stock/class/notification.class.php
1. The stock_amend.php is the main entrance. When user
invoke stock_amend.php with POST, stock_amend.php will
call:
include_once('edit/stock_amend.approve.php')
to execute authorization and data modifications.
2. In edit/stock_amend.approve.php program will
conditionally calling
include_once('class/notification.class.php');
to make logs.
Now the problem is, these codes works fine on my developing
platform (PHP4.10), but they failed to work on my client's
server (PHP4.20). I've got this message:
Warning: Failed opening 'class/notification.class.php' for
inclusion (include_path='c:\php4\pear') in c:/inetpub/
wwwroot/stock/edit/stock_amend.approve.php
on line 105
Now I rewrite my experimental codes:
c:/inetpub/wwwroot/test/a.php
c:/inetpub/wwwroot/test/inc/b.php
c:/inetpub/wwwroot/test/cls/c.php
c:/inetpub/wwwroot/test/inc/cls/c.php
test/a.php:
<?
echo "<BR>I'm a.php (".__FILE__.")";
include_once("inc/b.php");
?>
test/inc/b.php:
<?
echo "<BR>I'm b.php (".__FILE__.")";
include_once("cls/c.php");
?>
test/cls/c.php:
<?
echo "<BR>I'm CORRECT c.php (".__FILE__.")";
?>
test/inc/cls/c.php:
<?
echo "<BR>I'm WRONG c.php (".__FILE__.")";
?>
PHP 4.10 shows this result:
I'm a.php (c:/inetpub/wwwroot/test/a.php)
I'm b.php (c:/inetpub/wwwroot/test/inc/b.php)
I'm CORRECT c.php (c:/inetpub/wwwroot/test/cls/c.php)
But PHP4.20 shows this result:
I'm a.php (c:/inetpub/wwwroot/test/a.php)
I'm b.php (c:/inetpub/wwwroot/test/inc/b.php)
I'm WRONG c.php (c:/inetpub/wwwroot/test/inc/cls/c.php)
Of course I know that I can use full path in include_once()
to prevent this problem. The point is: PHP4.10 AND PHP4.20
DID INCLUDE DIFFERENT FILES AND I AM NOT TALKING ABOUT
__FILE__. There is nothing wrong with __FILE__ in 4.10 and
4.20. They all present the correct file path.
Previous Comments:
------------------------------------------------------------------------
[2002-06-01 09:39:02] sniper@php.net
For me it looks like 4.2.x works as expected.. __FILE__
outputs the correct path there.
------------------------------------------------------------------------
[2002-06-01 09:38:56] sniper@php.net
For me it looks like 4.2.x works as expected.. __FILE__
outputs the correct path there.
------------------------------------------------------------------------
[2002-05-31 23:48:29] ulysses@mail.fitan.com.tw
I found the PHP4.10 and PHP4.20 use different ways to
handle relative path when calling include_once(). Here is
an example. Consider the following file structure:
c:/inetpub/wwwroot/test/a.php
c:/inetpub/wwwroot/test/inc/b.php
c:/inetpub/wwwroot/test/cls/c.php
c:/inetpub/wwwroot/test/inc/cls/c.php
test/a.php:
<?
echo "<BR>now in ".__FILE__;
include_once("inc/b.php");
?>
test/inc/b.php:
<?
echo "<BR>now in ".__FILE__;
include_once("cls/c.php");
?>
test/cls/c.php and test/inc/cls/c.php
<?
echo "<BR>now in ".__FILE__;
?>
PHP 4.10 shows this result:
now in c:/inetpub/wwwroot/test/a.php
now in c:/inetpub/wwwroot/test/inc/b.php
now in c:/inetpub/wwwroot/test/cls/c.php
But PHP4.20 shows this result:
now in c:/inetpub/wwwroot/test/a.php
now in c:/inetpub/wwwroot/test/inc/b.php
now in c:/inetpub/wwwroot/test/inc/cls/c.php
I did not found related announcement in the 4.20 and 4.21
release notes, so I think it is a bug (or at least an
incompatiable issue.)
Here are my php.ini settings (in both 4.10 and 4.20):
1. Enable register_globals
2. Disable magic_quote_gpc
3. Change execution time limit to 60sec
4. Change max memory limit to 12MB
5. Change default_charset to big5
6. Change doc_root to c:/inetpub/wwwroot
7. Enable MSSQL extension
8. Disable cgi.force-redirect (in PHP4.20)
9. Install ZendOptimizer
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17551&edit=1