#39485 [Opn->Fbk]: mkdir() fails when pathname have space(s) on the final

From: Date: Tue, 21 Nov 2006 21:03:32 +0000
Subject: #39485 [Opn->Fbk]: mkdir() fails when pathname have space(s) on the final
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105267@lists.php.net to get a copy of this message
ID: 39485 Updated by: tony2001@php.net Reported By: v1d4l0k4 at gmail dot com -Status: Open +Status: Feedback Bug Type: *Directory/Filesystem functions Operating System: Windows XP (Win32 only) PHP Version: 5.2.0 New Comment: Cannot reproduce: C:\>php -r "var_dump(mkdir('dirname '));" bool(true) Previous Comments: ------------------------------------------------------------------------ [2006-11-13 04:29:24] 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 ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39485&edit=1

« previous php.bugs (#105267) next »