php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42517 set_include_path('') doesn't work as expected
Submitted: 2007-09-02 00:20 UTC Modified: 2018-06-24 04:22 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: php at ideacode dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.2.4 OS: Linux
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: php at ideacode dot com
New email:
PHP Version: OS:

 

 [2007-09-02 00:20 UTC] php at ideacode dot com
Description:
------------
There are legitimate "secure-operation" situations when you want the include path wiped out, so that all included files must be explicitly stated.

The obvious way to set this is with either:
set_include_path(''); // or
ini_set('include_path', '');

However, neither one of these sets the include path to '' on the latest version of PHP 4 or PHP 5 in Linux.

A non-obvious workaround is to use a whitespace string:
set_include_path(' '); // or
ini_set('include_path', ' ');

which does set the path to ' ' (which hopefully isn't a valid directory!).

I believe passing a lambda string to either set_include_path or ini_set('include_path') should set the path to the lambda string.

http://bytejar.com/ - Software Lessons Learned the Hard Way

Reproduce code:
---------------
$original_path = set_include_path('');


Expected result:
----------------
'' === get_include_path();

Actual result:
--------------
$original_path === get_include_path();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-25 21:28 UTC] powtac at gmx dot de
1. It seems that only setting at least 1 char "clears" the include_path. This can be tested with checking the (bool) result. Example: set_include_path(' ');

2. It seems that after setting or "unsetting" the include_path still ".:.." is active as path where PHP searches for files.
 [2018-05-05 18:54 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues
 [2018-05-05 18:54 UTC] requinix@php.net
Even with the include_path cleared, absolute and CWD-relative paths will continue to work. I'm not sure how forcing developers to use such a path, like one as simple as __DIR__."/a/b/c.php", adds security to places where path information is not already unknown.

Is there still any interest in this? Can someone give more details about a problem this would solve?
 [2018-06-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC