php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45288 set_include_path() functionality broken
Submitted: 2008-06-17 01:00 UTC Modified: 2008-08-14 01:04 UTC
Votes:7
Avg. Score:4.6 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:3 (42.9%)
Same OS:2 (28.6%)
From: php at isnoop dot net Assigned: dmitry (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.3CVS-2008-06-17 (snap) OS: Ubuntu 7.04 server
Private report: No CVE-ID: None
 [2008-06-17 01:00 UTC] php at isnoop dot net
Description:
------------
In previous versions of PHP, set_include_path() would return the previously set path after setting the new path passed to it.

In my tests, set_include_path() returns false and does not set the path as it should.  This behavior is the same whether the path to be set exists or not.

The data in the Expected Result field can be seen with 5.1.2 and 5.2.6.

The Actual Result data has been replicated in the following snaps:
5.3-200804251630
5.3-200806162030
5.3-200806172030


Reproduce code:
---------------
echo "<pre>getting: ".get_include_path()."\n";
echo "setting: ".set_include_path("/NEWPATH")."\n";
echo "getting: ".get_include_path();

Expected result:
----------------
getting: /websites/example/htdocs:/websites/example/inc/
setting: /websites/example/htdocs:/websites/example/inc/
getting: /NEWPATH


Actual result:
--------------
getting: /websites/example/htdocs:/websites/example/inc/
setting:
getting: /websites/example/htdocs:/websites/example/inc/

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-24 16:59 UTC] NiX0n at fragfest dot cx
Using ini_set("include_path", $path) has equivalent results.
 [2008-07-10 23:29 UTC] m dot hildenbrand at gmx dot net
Hi,
did you have any php_admin_value include_path Statement in your httpd options ? If so, set_include_path() doesn't do anything as it protects your httpd options. Remove any php_admin_value include_path statement from your config and try again. The set_include_path() statement should work properly.

I don't know for sure if this is the correct behavior of the function.
 [2008-07-11 00:38 UTC] php at isnoop dot net
This is reproducible without the use of php_admin_value.
 [2008-07-26 17:04 UTC] dmitry@php.net
I'm not able to reproduce it. set_include_path() works as expected.
 [2008-07-28 20:33 UTC] php at isnoop dot net
Dmitry,
I've tested it with the latest snap (php5.3-200807281630) and it is still broken for me.  My tests are against php.ini-dist.

Are you using the repro code or some other approach?  Also, could you repeat your test with the dist php.ini?
 [2008-07-29 08:35 UTC] dmitry@php.net
Works fine with php.ini-dist

[dmitry@tpl CGI-DEBUG]$ cat bug45288.php
<?php
echo "getting: ".get_include_path()."\n";
echo "setting: ".set_include_path("/NEWPATH")."\n";
echo "getting: ".get_include_path()."\n";

[dmitry@tpl CGI-DEBUG]$ sapi/cli/php bug45288.php
getting: .:/home/dmitry/php/usr/php5.3-debug/share/pear
setting: .:/home/dmitry/php/usr/php5.3-debug/share/pear
getting: /NEWPATH


 [2008-08-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-08-14 01:04 UTC] php at isnoop dot net
Okay, it appears that the host in question was indeed using php_admin_value to set include_path, which is no longer able to be overridden at runtime.

This change was introduced in 5.2.5, ticket #41561.

Closing ticket.
 [2011-11-02 09:07 UTC] login dot naitsirch at arcor dot de
PHP should throw a Warning or even an Error, if the include path has been set in the config by using php_admin_value. This would help to find the problem. Otherwise you just get the return value "false". This is not helpful to solve the problem and you have to search the internet what could be the reason that set_include_path() does not work. And you do not find anything about that in the documentation (as far as I know).

Please change something.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 19:01:29 2024 UTC