#22105 [NEW]: mkdir changes the variable passed to it

From: Date: Fri, 07 Feb 2003 10:39:47 +0000
Subject: #22105 [NEW]: mkdir changes the variable passed to it
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32372@lists.php.net to get a copy of this message
From: bram@smartelectronix.com Operating system: Linux PHP version: 4.2.2 PHP Bug Type: Directory function related Bug description: mkdir changes the variable passed to it $tmp = "xx/yy"; $parts = explode("/",$tmp); for($i=0;$i<count($parts);$i++) { $directory = 'files'; //my base-dir //strange loop to show the error for($j=0;$j<=$i;$j++) $directory = $directory . '/' . $parts[$j]; echo 'before :: ' . $directory . '<br>'; @mkdir($directory,0775); echo 'after :: ' . $directory . '<br>'; } outputs: before :: files/xx after :: files/xx before :: files/xx/yy after :: files/xxyy The last line has the error. As you can see mkdir() changes the variable. Even if the rest of the code is buggy ( ;) ) this shouldn't happen :) - bram -- Edit bug report at http://bugs.php.net/?id=22105&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22105&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22105&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22105&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22105&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22105&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22105&r=support Expected behavior: http://bugs.php.net/fix.php?id=22105&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22105&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22105&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22105&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22105&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22105&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22105&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22105&r=gnused

« previous php.bugs (#32372) next »