|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62871 mkdir(): wrong behaviour parsing schema:// in parameters
Submitted: 2012-08-20 10:42 UTC Modified: 2021-08-23 17:00 UTC
Avg. Score:4.3 ± 0.8
Reproduced:8 of 8 (100.0%)
Same Version:4 (50.0%)
Same OS:2 (25.0%)
From: php dot net at thermoman dot de Assigned: cmb (profile)
Status: Closed Package: Directory function related
PHP Version: 5.4.6 OS: Linux
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:
39 + 22 = ?
Subscribe to this entry?

 [2012-08-20 10:42 UTC] php dot net at thermoman dot de
mkdir does parse :// in argument as schema/protocol and truncates the string resulting in wrong directory being created.

Possibly more functions affected (fopen, ...).

mkdir("/var/tmp/http://foobar", 0700, true);
mkdir("/var/tmp/abcd://barbaz", 0700, true);

Creates wrong directories.

Test script:
% find foobar /var/tmp/http:

find: `foobar': No such file or directory
find: `/var/tmp/http:': No such file or directory

% ~/php546/bin/php -r 'var_dump(mkdir("/var/tmp/http://foobar", 0700, true));'

% find foobar /var/tmp/http:

find: `/var/tmp/http:': No such file or directory

==> PHP created directory 'foobar' in current working directory

Expected result:
directory "/var/tmp/http:" is created
directory "/var/tmp/http:/foobar" is created

like gnu mkdir:

% mkdir -p "/var/tmp/http://foobar"

% find /var/tmp/http:



Actual result:
directory "foobar" is created in current working directory


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-23 17:00 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-08-23 17:00 UTC]
This has apparently been fixed in the meantime (tested with
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 24 01:03:38 2021 UTC