php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20616 4.3.0RC1-Win32 cannot find files found by 4.2.3
Submitted: 2002-11-25 03:51 UTC Modified: 2002-12-09 07:50 UTC
From: judd at ob-wan dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.0RC1 OS: Win 2k server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: judd at ob-wan dot com
New email:
PHP Version: OS:

 

 [2002-11-25 03:51 UTC] judd at ob-wan dot com
include("../application.php");

The above simple inclusion no longer works in
4.3.0RC1-Win32 where it worked fine in 4.2.3.

Looks like the typical Unix-user misunderstanding
of how Windows uses the filesystem to me.

*sigh* Will it never end...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-25 08:56 UTC] iliaa@php.net
Using the given information I cannot replicate the problem.
 [2002-11-29 06:59 UTC] judd at ob-wan dot com
RC2 also fails identically, see error message below. You might also like to complete the HTML tags in the error messages so that an error displays correctly. Relying on a browser version that doesn't mind missing </body></html> tags is a Bad Idea(tm).

Warning: main(../application.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in
C:\Xitami\webpages\Commerce\mymarket1\admin\index.php on line 8 Warning: Failed opening '../application.php' for inclusion
(include_path='.;c:\php4\pear') in C:\Xitami\webpages\Commerce\mymarket1\admin\index.php on line 8 Fatal error: Call to undefined function:  pv() in C:\Xitami\webpages\Commerce\mymarket1\admin\templates\header.php on line 3
 [2002-11-29 07:08 UTC] judd at ob-wan dot com
My reply from the 26th:

Hi Iliaa,

OK, looks like you need further information to find this one. I would
add further comments but bugs.php.net is frozen right now when
attempting to edit bug reports.

Let's take the following piece of code:

-------------

<?
/* application.php */

/* turn on verbose error reporting */
error_reporting(15);

/* define a generic object */
class object {};

/* setup the configuration object */
$CFG = new object;

$CFG->dbhost = "localhost";
$CFG->dbname = "mymarket";
$CFG->dbuser = "myuser";
$CFG->dbpass = "mypassword";

$CFG->wwwroot = "/Commerce/mymarket3";
$CFG->dirroot     = "";
$CFG->templatedir = "$CFG->dirroot/templates";
$CFG->libdir      = "$CFG->dirroot/lib";
$CFG->imagedir    = "$CFG->wwwroot/images";

$CFG->wordlist    = "$CFG->libdir/wordlist.txt";
$CFG->support     = "support@mymarket.com";

/* define database error handling behavior, since we are in development
 * we will turn on all the debugging messages to help us troubleshoot */
$DB_DEBUG = true;
$DB_DIE_ON_FAIL = true;

/* load up standard libraries */
require("$CFG->libdir/stdlib.php");
require("$CFG->libdir/dblib.php");
require("$CFG->libdir/mymarket.php");
require("$CFG->libdir/cart.php");

----------------------

In 4.2.3 this will work fine, whilst in 4.3.0RC1 you'll get an error on
the line:

require("$CFG->libdir/stdlib.php");

That's because there will be a slash prepended where it wasn't there
before.

Note that '$CFG->libdir' is made from '$CFG->dirroot' plus '/lib'. With
'$CFG->dirroot' being empty this should resolve to no leading slash,
which was correct in 4.2.3 but now isn't. Otherwise there's no way to
include a relative path.

I'd get in and fix this myself but I've spent far too many years
repairing other people's broken code for free, and since this is my
profession it doesn't make sense to do that any more. But a pointer on
where the error might be ... if you're using Cygwin and changed
versions, that's probably it. Get rid of it before you go blind and use
MSVC 5.0 or later, it works. Really.

Rob Judd
Homepage: http://judd.ob-wan.com
 [2002-11-29 07:20 UTC] wez@php.net
Now that you have given us the info, we can resolve the problem, for free.
Instead of complaining, you could just contribute your obviously superior knowledge of windows and help us fix it.
Keep the attitude out of the reports please.

 [2002-12-07 02:05 UTC] iliaa@php.net
Can you please include the error message that you get?
 [2002-12-07 02:14 UTC] judd at ob-wan dot com
Iliaa - see Nov 29 message.
 [2002-12-08 11:00 UTC] sniper@php.net
So the problem is that 'require("/foobar.php");' does not find foobar under the current working dir?? If so, this really is not a bug but the correct behaviour.

 [2002-12-08 18:19 UTC] judd at ob-wan dot com
Nope. The problem is that "include ../foobar.inc" does not find foobar.inc in the parent directory, which is contrary behaviour to 4.2.3
 [2002-12-08 18:21 UTC] judd at ob-wan dot com
Pardon me, that syntax should be 'include ("../foobar.inc");' ... I just woke up. :0
 [2002-12-08 22:37 UTC] sniper@php.net
Some clarification needed..the error you got:

"No such file or directory in C:\Xitami\webpages\Commerce\mymarket1\admin\index.php on line 8 Warning:  Failed opening '../application.php' for inclusion"


In index.php you have 'include("../application.php");' ?
Is the path to "application.php": C:\Xitami\webpages\Commerce\mymarket1\admin\application.php ???

 [2002-12-09 02:10 UTC] judd at ob-wan dot com
Nope. application.php is in the parent directory, or:

C:\Xitami\webpages\Commerce\mymarket1\application.php
 [2002-12-09 05:14 UTC] black@php.net
could you list the directory structure of "used" files..

im mainly interested in the main script, admin/index.php and application.php.

if the main script is in the same dir as application.php and includes admin/index.php, then the problem most probablly lies there, since the include path doesnt change from the main script to its includes..

other than that try downgrading to 4.2.3 just to see if the problem remains - if yes, then its a script error in your code and not in php4.3RC2 itself.
 [2002-12-09 05:31 UTC] judd at ob-wan dot com
Black,

I'm simply calling ../application.php from admin/index.php, there's nothing else involved. This particular piece of code works fine in 4.2.3
 [2002-12-09 07:50 UTC] edink@php.net
I juste tested the latest stable snapshot (http://snaps.php.net/win32/php4-win32-STABLE-latest.zip) and could not reproduce the problem using CLI or Apache modules. If the problem existed it was fixed since RC1.

 [2003-02-14 17:14 UTC] thanerd at skynet dot be
while testing a third party script that does:
require_once("db/foo.php");
i got an error reporting 'No such file or directory'.
Being under Win OS, i checked to see if
require_once("db\\foo.php");
would work. And it DOES!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 11:01:31 2024 UTC