php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39485 mkdir() fails when pathname have space(s) on the final
Submitted: 2006-11-13 04:29 UTC Modified: 2013-02-18 00:33 UTC
Votes:6
Avg. Score:3.0 ± 1.2
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: v1d4l0k4 at gmail dot com Assigned:
Status: No Feedback Package: *Directory/Filesystem functions
PHP Version: 5.2.0 OS: Windows XP (Win32 only)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: v1d4l0k4 at gmail dot com
New email:
PHP Version: OS:

 

 [2006-11-13 04:29 UTC] v1d4l0k4 at gmail dot com
Description:
------------
The 'mkdir' function doesn't function correctly on Windows when the pathname contain space(s) on the final. PHP returns a warning, and the directory isn't created:

Warning: mkdir() [function.mkdir]: Invalid argument in X on line Y

Temporary fix: use trim() on the pathname

Besides, if the pathname contain space(s) on the start, the directory is created when couldn't even so (in accordance with the behavior of Windows Explorer).

Reproduce code:
---------------
<?php

mkdir('pathname ');
mkdir(' pathname');

?>

Expected result:
----------------
<?php

mkdir('pathname '); // Succeeds, but trim() before, in accordance with the behavior of Windows Explorer
mkdir(' pathname'); // Succeeds, but trim() before, in accordance with the behavior of Windows Explorer

?>

Actual result:
--------------
<?php

mkdir('pathname '); // Fails
mkdir(' pathname'); // Succeeds even not being recommended

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-21 21:03 UTC] tony2001@php.net
Cannot reproduce:

C:\>php -r "var_dump(mkdir('dirname '));"
bool(true)

 [2006-11-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-07-14 03:50 UTC] felipe@php.net
-Status: No Feedback +Status: Feedback
 [2010-07-14 03:50 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:33 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC