php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77680 recursive mkdir on ftp stream wrapper is incorrect
Submitted: 2019-02-28 12:38 UTC Modified: -
From: calin dot don at gmail dot com Assigned:
Status: Closed Package: Directory function related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2019-02-28 12:38 UTC] calin dot don at gmail dot com
Description:
------------
Recursive mkdir on ftp stream wrapper is incorrectly implemented. It issues a CWD and MKD without a required path parameter for the root folder.

Test script:
---------------
<?php
mkdir("ftp://localhost:2121/one/two", 0755, true);

Expected result:
----------------
Recursively create the directory structure.

Actual result:
--------------
Fails becuase it creates invalid sequence of ftp commands:

2019/02/28 13:43:12 INFO  : f91b572012ab40453052: > CWD /one
2019/02/28 13:43:13 INFO  : f91b572012ab40453052: < 550 Directory change to /one failed: file does not exist
2019/02/28 13:43:13 INFO  : f91b572012ab40453052: > CWD
2019/02/28 13:43:13 INFO  : f91b572012ab40453052: < 553 action aborted, required param missing
2019/02/28 13:43:13 INFO  : f91b572012ab40453052: > MKD
2019/02/28 13:43:13 INFO  : f91b572012ab40453052: < 553 action aborted, required param missing

Patches

fix-77680 (last revision 2019-03-01 15:47 UTC by cmb@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-01 15:47 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: fix-77680
Revision:   1551455239
URL:        https://bugs.php.net/patch-display.php?bug=77680&patch=fix-77680&revision=1551455239
 [2019-03-25 16:46 UTC] nikic@php.net
Automatic comment on behalf of vladtemian@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ec2ecb7e12b96f8f95af2885d173a0d46c88e190
Log: Fix bug #77680: Correctly implement recursive mkdir on FTP stream
 [2019-03-25 16:46 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Sep 20 12:01:27 2019 UTC