|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36855 is_dir and opendir + path ending with space
Submitted: 2006-03-25 03:54 UTC Modified: 2006-04-09 22:32 UTC
From: r21vo1 at gmail dot com Assigned: pollita (profile)
Status: Not a bug Package: Directory function related
PHP Version: 5.1.2 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 - 42 = ?
Subscribe to this entry?

 [2006-03-25 03:54 UTC] r21vo1 at gmail dot com
is_dir() doesn't fail if path ends with additional space, opendir does.

Reproduce code:
create dir, for example "bla"
var_dump(is_dir("bla "));
var_dump(opendir("bla "));

Expected result:
Both should be either true or false.

Actual result:
is_dir() returns true, opendir() returns false.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-25 12:15 UTC]
Please try using this CVS snapshot:
For Windows:

Can't reproduce
 [2006-03-25 12:58 UTC] r21vo1 at gmail dot com
Tested, problem remains.
I also tested on my freebsd box with php 5.1.2, works correctly (both values false).
 [2006-03-26 00:47 UTC]
Sara, please take a look at it.
Looks like a windows weirdness, but I'm unable to test it.
 [2006-04-09 22:32 UTC]
This is an oddity of win32 api, and not a bug in PHP.

Try this on command line and you will see this strange behaviour is a "feature" of the operating system.

md test
cd "test "

Windows happily complies with it.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 14:01:29 2024 UTC