|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
Cannot reproduce: C:\>php -r "var_dump(mkdir('dirname '));" bool(true)