#34106 [NEW]: "explode" chopping "\" plus first letter of directory

From: Date: Fri, 12 Aug 2005 18:07:50 +0000
Subject: #34106 [NEW]: "explode" chopping "\" plus first letter of directory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83470@lists.php.net to get a copy of this message
From: olstairs at rogers dot com Operating system: Windows XP Pro SP2 PHP version: 5.0.4 PHP Bug Type: Directory function related Bug description: "explode" chopping "\" plus first letter of directory Description: ------------ When I ran a script it chopped the "\" plus the first letter of a directory when processing some copy commands. I looked at the script, and I think maybe the problem had something to do with the "explode" function. I apologize for not being able to be more certain of this, but I am not a coder. Reproduce code: --------------- // create dirs for processing the file (server) if ( $this->move_method == 'copy') { $dir_path = '' ; $splitarray = explode('/', $copy_path) ; for ($idir=0; $idir<count($splitarray); $idir++) { $dir_path .= trim($splitarray[$idir]) ; // don't bother making ../ ;-) if ($splitarray[$idir] == '..') { // do nothing } else if (!file_exists($dir_path)) { // use the mkdir command mkdir($dir_path, 0777); chmod($dir_path, 0777); } $dir_path .= '/' ; } } Expected result: ---------------- It is supposed to copy a file from "directoryX" to "directoryY\newlocation". Actual result: -------------- An error because it actually tries to copy the file from "directoryX" to "directoryYewlocation". -- Edit bug report at http://bugs.php.net/?id=34106&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34106&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34106&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34106&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34106&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34106&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34106&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34106&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34106&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34106&r=support Expected behavior: http://bugs.php.net/fix.php?id=34106&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34106&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34106&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34106&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34106&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34106&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34106&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34106&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34106&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34106&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34106&r=mysqlcfg

« previous php.bugs (#83470) next »