php.net |  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: -
Votes:8
Avg. Score:4.4 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:4 (57.1%)
Same OS:2 (28.6%)
From: php dot net at thermoman dot de Assigned:
Status: Open Package: Directory function related
PHP Version: 5.4.6 OS: Linux 2.6.37.6
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-08-20 10:42 UTC] php dot net at thermoman dot de
Description:
------------
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));'
bool(true)

% find foobar /var/tmp/http:

foobar
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:

/var/tmp/http:

/var/tmp/http:/foobar


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

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Nov 15 11:01:33 2019 UTC