Bug #62871 [Opn->Csd]: mkdir(): wrong behaviour parsing schema:// in parameters

From: Date: Mon, 23 Aug 2021 17:00:42 +0000
Subject: Bug #62871 [Opn->Csd]: mkdir(): wrong behaviour parsing schema:// in parameters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236027@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62871&edit=1

 ID:                 62871
 Updated by:         cmb@php.net
 Reported by:        php dot net at thermoman dot de
 Summary:            mkdir(): wrong behaviour parsing schema:// in
                     parameters
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Directory function related
 Operating System:   Linux 2.6.37.6
 PHP Version:        5.4.6
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

This has apparently been fixed in the meantime (tested with
PHP-7.4).


Previous Comments:
------------------------------------------------------------------------
[2012-08-20 10:42:57] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=62871&edit=1


Thread (2 messages)

« previous php.bugs (#236027) next »