|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-05-31 14:17 UTC] greg at chiaraquartet dot net
the Pear packager attempts to mktemp a directory as a subdirectory of the current directory. If the current directory has any spaces in its name (I have C:\Web Pages), then it will fail. This is because System::mktemp is called with "-t C:\Web Pages -d" _parseArgv's use of a regexp parses the result into "-t C:\Web" and "Pages -d" A better command-line parsing algorithm is in phpDocumentor's Io class, it allows spaces and simply recognizes the command-line params. Greg PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 07:00:01 2025 UTC |
A fix allows quoted arguments, so it would be called with -t "C:\Web Pages" -d and expand properly. Here is the diff with System.php: 64a65,93 > $newargv = array(); > $in_quote = false; > $index = 0; > foreach($argv as $arg) > { > if (!isset($newargv[$index])) { > $newargv[$index] = ''; > } > // combine quoted values into 1 string > if (!$in_quote && $arg{0} == '"') { > $newargv[$index] = substr($arg,1); > $in_quote = true; > } elseif ($in_quote && $arg{strlen($arg) - 1} == '"') { > $arg = ' ' . $arg; > $newargv[$index] .= substr($arg,0,strlen($arg) - 1); > $in_quote = false; > $index++; > } else { > if ($in_quote) { > $arg .= ' '; > } > $newargv[$index] .= $arg; > if (!$in_quote) { > // go to next value if not in a quote > $index++; > } > } > } > $argv = $newargv; and the diff against Packager.php: 119c119 < if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) { --- > if (!($tmpdir = System::mktemp('-t "'.getcwd().'" -d'))) {In addition, line 382 of System.php (in System::mktemp()) needs to be: if (!System::mkDir("-p \"$tmpdir\"")) { instead of if (!System::mkDir("-p $tmpdir")) { after the last applied patch