|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-03 11:02 UTC] malaney at gmail dot com
Description:
------------
Paths after the first directory separator in a set_include_path() or ini_set('include_path') call are ignored when running the phar extension 2.0.0b1. After installing phar-2.0.0b1 on my Macbook, all my require's failed. Seems like DIRECTORY_SEPARATOR may be munged on Mac OS X.
Reproduce code:
---------------
<?php
$PATH1 = "/path/to/libs";
$PATH2 = $PATH1 . "/pear";
print set_include_path($PATH1 . DIRECTORY_SEPARATOR . $PATH2);
require $PATH2 . 'MDB2.php';
print 'File included';
?>
Expected result:
----------------
File included
Actual result:
--------------
Warning: require_once('/path/to/libs/MDB2.php') [function.require-once]: failed to open stream: No such file or directory in test_script.php on line 4
Fatal error: require_once() [function.require]: Failed opening required 'MDB2.php' (include_path='/path/to/libs:/path/to/libs/pear') in test_script.php on line 4
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 13:00:01 2025 UTC |
Hi, Can you please alter your script slightly and try this instead? Your original script doesn't work for me either, I'm just trying to establish whether there is a reproducible bug. <?php $PATH1 = "libs"; $PATH2 = $PATH1 . "/pear"; set_include_path($PATH1 . ';' . $PATH2); print get_include_path()."\n"; require $PATH2 . '/MDB2.php'; print 'File included'; /* expected output: libs;libs/pear File included */ ?> Thanks, - StephCan you please confirm that you're seeing this with: <?php $PATH1 = "path/to/libs"; $PATH2 = $PATH1 . "/pear/"; set_include_path($PATH1 . PATH_SEPARATOR . $PATH2); print get_include_path()."\n"; require 'MDB2.php'; print 'File included'; ?> and also please post your output if that's failing for you? NB I'm not able to reproduce any problem under Windows.I can reproduce this "bug". This is not a MacOSX only issue, and I actually haven't had time to reproduce it on there but if you guys request me to, I will do so next weekened. I found this bug on Ubuntu 8.04 (LTS), PHP 5.2.4, I had the phar extension installed (please check with Brett on installing it) and since then it failed traversing through the different include paths. For example: <?php // this fails set_include_path(".:/usr/share/php"); require_once "PEAR.php"; ?> While this works: <?php // this works set_include_path("/usr/share/php:."); require_once "PEAR.php"; ?> If I remove the phar extension, it all goes back to normal. I strace'd the script and without strace it doesn't even check in /usr/share/php if it comes second. Also, according to my second example, it will also fail to include files from the same directory as the script itself. For example: Layout foo/script.php foo/script2.php foo/script.php contains: <?php // this fails set_include_path('/usr/share/php:.'); require 'script2.php'; ?>