ID: 45181
Updated by: [email protected]
Reported By: webmaster at villagersonline dot com
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 5.2.5
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-06-04 18:54:13] webmaster at villagersonline dot com
Description:
------------
If you check a relative pathname with is_dir(), the result is cached.
However, chdir() does not invalidate that cache. Thus, after a chdir(),
is_dir() using the same relative pathname gives invalid results.
NOTE: In truth, I'm running PHP 5.2.5, not 5.2.6. But this is on a
professional hosting service, and I can't control the version.
Reproduce code:
---------------
<?
// note that if you run this script multiple times, then all the
// mkdir()s will give errors, since they already exist. That's
// irrelevant to the bug.
// I put this all inside a subdirectory so as to not clutter up the
// pwd of the script. Again, irrelevant to the bug.
mkdir("x");
chdir("x");
clearstatcache();
// key reproduce code starts here
mkdir("y");
mkdir("z");
var_dump(is_dir("z"));
chdir("y");
var_dump(is_dir("z")); // this is where the bug is exposed
var_dump(is_dir(getcwd()."/z"));
clearstatcache();
var_dump(is_dir("z"));
?>
Expected result:
----------------
bool(true)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
bool(false)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45181&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.