php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19689 4.2.3 and higher "include" operator mistake
Submitted: 2002-10-01 08:02 UTC Modified: 2002-11-14 07:46 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:2 (50.0%)
From: dmitry at koteroff dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4CVS-2002-10-01 OS: Windows
Private report: No CVE-ID:
 [2002-10-01 08:02 UTC] dmitry at koteroff dot ru
I'm trying to write here THIRD time (maybe previous two threads is down?). You said before this bug in NOT actual in 4.2.3 and in CVS snapshot:
  http://snaps.php.net/win32/php4-win32-latest.zip
but code STILL DOES NOT work in 4.2.3 and 4.3.0-dev.

So, PHP v4.2.0 (and later!) on Windows:
include "/home/some/site.php";
- DOES NOT work (try to believe)! We have to use instead:
include "z:/home/some/site.php"; # bad... Bad?.. BAD!!!

Previous PHP v4.1.0:
include "/home/some/site.php";
- works correct.

I think that since 4.2.0 pathes like "/some/where" does not treated as absolute. For example, if we add "z:" to "include_path", include "/home/some/site.php" become workable - it is only the prove.

It is VERY loathsome bug, because it makes Windows scripts incompatible with Unix and with previous PHP versions.

Again, new version (4.3.0) has THE SAME bug:

Z:\!distrib\php-4.2.3-Win32>php.exe
<?
include "/test.php";
?>
^Z

Warning: Failed opening '/test.php' for inclusion
(include_path='.;c:\php4\pear') in - on line 2

If I use "include 'z:/test.php'", it works. 
Please help (our clients are very angry!)

P.S.
DocumentRoot "/home/site/www"
...
GET http://site/test.php - DOES NOT work too. It seems to me mod_php uses the same "include" function while starting the script.

P.P.S.
I'm not a nasty man, but I would write here again if you continue ignore these messages like previous two. Generally speaking, good luck & thank you for PHP as such.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-01 08:03 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in PHP.
 [2002-10-01 08:06 UTC] derick@php.net
Oh, I forgot:

http://www.derickrethans.nl/20020426.php
 [2002-10-01 08:58 UTC] dmitry at koteroff dot ru
OK, if you cannot correct your own program without misleading words (you said before TWICE that there is no bug, and it is the ONLY thing disagreeable to me), get it:

php-4.2.3/TSRM/tsrm_virtual_cwd.h, line 56:

- #define IS_ABSOLUTE_PATH(path, len) \
-	(len >= 2 && isalpha(path[0]) && path[1] == ':')

+ #define IS_ABSOLUTE_PATH(path, len) \
+	(len >= 2 && isalpha(path[0]) && path[1] == ':') \
+       || (len >= 1 && IS_SLASH(path[0]))

This section is under #ifdef TSRM_WIN32 block (of course). 

I'm not a specialist in PHP core, so I have spent about an hour to find bug location. Unfortunately I CANNOT stop on that, because our users still download PHP from your site. I will be very glad if you correct this bug in the next version (4.3.0 I suppose?).
 [2002-10-01 08:58 UTC] dmitry at koteroff dot ru
OK, if you cannot correct your own program without misleading words (you said before TWICE that there is no bug, and it is the ONLY thing disagreeable to me), get it:

php-4.2.3/TSRM/tsrm_virtual_cwd.h, line 56:

- #define IS_ABSOLUTE_PATH(path, len) \
-	(len >= 2 && isalpha(path[0]) && path[1] == ':')

+ #define IS_ABSOLUTE_PATH(path, len) \
+	(len >= 2 && isalpha(path[0]) && path[1] == ':') \
+       || (len >= 1 && IS_SLASH(path[0]))

This section is under #ifdef TSRM_WIN32 block (of course). 

I'm not a specialist in PHP core, so I have spent about an hour to find bug location. Unfortunately I CANNOT stop on that, because our users still download PHP from your site. I will be very glad if you correct this bug in the next version (4.3.0 I suppose?).
 [2002-10-01 09:09 UTC] jmoore@php.net
Hello,

A lot of people work very hard on PHP for no money, there is a general etiquette which is advisable to stick to when reporting a bug and that is to be nice. Now I havnt looked at your other reports personally and I dont know why they were marked as bogus (perhaps someone was tired, could not understand exactly what you mean or for many other reasons) and I appolgize for that, a better way to approach it is to ask why the bug has been marked as bogus rather than ranting that it has. 

We deal with many bugs each day and have limited time thus those that get fixed are those which either are highly important to us (If Im affected by a bug Ill fix it myself I wont expect other people too) or one that affects a lot of people. 

Remember you have not paid for PHP and are asking us to do work for you for free. Now you have spent an hour fixing that bug and Ill have a look at the patch now check it fixes it and does not break anything else and if that is the case then it will be applied before the next version and I thank you for your time, but I promise you it will still use up at least 20 mins of my time (and IMHO my time is more important to me than your time is).

So what I am saying is that yes you have a bug in PHP you want fixed but dont expect it to happen straight away, localizing and fixing a bug and checking its implications is a slow and boring game and we dont always get it right but we do it for free so have a touch more patience with us and we are likley to be more helpful.

Sorry to rant.

- James


 [2002-10-01 10:15 UTC] dmitry at koteroff dot ru
All I want is only to make this bug "open", but not "bogus".
Now it is all right. Thank you.
 [2002-10-01 10:35 UTC] sniper@php.net
DO NOT open more bug reports about this SAME issue.
Thank you.

 [2002-10-13 19:24 UTC] webdevguy1 at yahoo dot com
I may be experiencing a related problem with php.ini. It seems PHP does not recognize subdirectories (Windows only?). For example, the following is OK:

include_path = ".;C:\PHPinc;C:\Templates"

and the following is not OK:

include_path = ".;C:\PHPinc;C:\PHPinc\Templates"

I am running:

PHP 4.2.3
Windows 2000 Pro
Apache 1.3.27
Mod_SSL 2.8.11
OpenSSL 0.9.6g
 [2002-10-13 21:41 UTC] sniper@php.net
This really should be fixed before 4.3.0-dev is released..

 [2002-10-29 07:28 UTC] dekamerone at iprobe dot de
Hi all,

php.ini let you do a quick and easy hack to solve this bug for Win2000 (maybe other WinOS will work with this too):
Only change include_path in php.ini as follows:
include_path = "c:"

looks strange but solves the problem ...

Have fun : deka
 [2002-11-14 07:46 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-11-23 18:05 UTC] dmitry at koteroff dot ru
I'd like to say that in php-4.3.0RC1-Win32 there are problems with fopen:

bug.php:
<?
echo "\n".getcwd()."<br>\n";
fopen("/a.txt","w");
?>

Z:\!distrib\php\php-4.3.0RC1-Win32>php.exe bug.php

Z:\!distrib\php\php-4.3.0RC1-Win32<br>

Warning: fopen(/a.txt) [http://www.php.net/function.fopen]: failed to create stream: No such file or directory in Z:\!distrib\php\php-4.3.0RC1-Win32\bug.php on line 3

You see if I use z:/a.txt, all works correctly. 
In PHP 4.3.0-dev (cli) (built: Nov 23 2002 18:15:57) everything seems to be OK.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 12:01:52 2014 UTC