|  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: -
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:
Status: Open Package: Directory function related
PHP Version: 5.4.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: php dot net at thermoman dot de
New email:
PHP Version: OS:


 [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

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 31 11:01:24 2020 UTC