php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22105 mkdir changes the variable passed to it
Submitted: 2003-02-07 04:39 UTC Modified: 2003-02-20 08:09 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: bram at smartelectronix dot com Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 4.2.2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bram at smartelectronix dot com
New email:
PHP Version: OS:

 

 [2003-02-07 04:39 UTC] bram at smartelectronix dot 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-20 08:09 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 09:01:29 2024 UTC