#22105 [Opn->Fbk]: mkdir changes the variable passed to it
| From: | iliaa@php.net | Date: | Sat, 08 Feb 2003 01:42:51 +0000 |
| Subject: | #22105 [Opn->Fbk]: mkdir changes the variable passed to it | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32425@lists.php.net to get a copy of this message | ||
ID: 22105
Updated by: iliaa@php.net
Reported By: bram@smartelectronix.com
-Status: Open
+Status: Feedback
Bug Type: Directory function related
Operating System: Linux
PHP Version: 4.2.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2003-02-07 04:39:47] bram@smartelectronix.com
$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 this bug report at http://bugs.php.net/?id=22105&edit=1