php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34106 "explode" chopping "\" plus first letter of directory
Submitted: 2005-08-12 20:07 UTC Modified: 2005-08-12 22:39 UTC
From: olstairs at rogers dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.0.4 OS: Windows XP Pro SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
11 + 26 = ?
Subscribe to this entry?

 
 [2005-08-12 20:07 UTC] olstairs at rogers dot com
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".

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-12 22:39 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC