|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-05-12 19:28 UTC] joomla at itronic dot at
Description:
------------
If you change the root dir, the __DIR__ doesn't reflect the change. Maybe this effects other Magic constants.
Test script:
---------------
chroot('/tmp');
echo __DIR__;
Expected result:
----------------
__DIR__ should have the correct path.
Actual result:
--------------
The old path
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 21:00:01 2025 UTC |
It's chroot, not chdir. The idea is that __DIR__ and friends should be updated to reflect the new path to the file after the chroot(2) call. Which is not necessarily possible (eg, file is outside the new root) so I don't know if anything can/should be done about it anyways. echo __FILE__; // originally /path/to/file.php chroot("/path"); echo __FILE__; // now /to/file.php