php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #23456 CLI version path handling makes includes non-portable
Submitted: 2003-05-02 17:15 UTC Modified: 2003-05-02 19:30 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: don at lekei dot ca Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.1 OS: ANY
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: don at lekei dot ca
New email:
PHP Version: OS:

 

 [2003-05-02 17:15 UTC] don at lekei dot ca
When a script has an include statement such as:

include_once("../includes/session.php");

(This file works with 4.2.3)

It fails to find the include file because it is not searching relative to the script directory.

This seems similar to other reported bugs but the file in question works fine when executed with the CGI or SAPI versions of PHP and worked fine with 4.2.3 cli but not with 4.3.1

The temporary work-around is to specify the absolute path to the include file (ewww!) or calculate the path (messy but portable).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-02 17:24 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

CLI was EXPERIMENTAL in 4.2.x and RTFM.
 [2003-05-02 18:08 UTC] don at lekei dot ca
Making the working directory relative to the invocation path improves the ability to write filters but renders all existing scripts, libraries and classes unusable for command-line applications.

A configuration option should be added to make includes relative to the script path instead of the working directory so libraries and classes can be used in a portable manner.
 [2003-05-02 19:30 UTC] derick@php.net
Just chdir to the working directory then, or use the CGI for command line scripting which does the chdir for you. It was intended to work like this, and it will not change.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 11:01:31 2024 UTC