php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41063 chdir doesn't like root paths.
Submitted: 2007-04-12 14:19 UTC Modified: 2007-04-12 15:29 UTC
From: RQuadling at GMail dot com Assigned: dmitry (profile)
Status: Closed Package: Directory function related
PHP Version: 5CVS-2007-04-12 (snap) OS: Windows XP SP2
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: RQuadling at GMail dot com
New email:
PHP Version: OS:

 

 [2007-04-12 14:19 UTC] RQuadling at GMail dot com
Description:
------------
chdir('D:/') doesn't work. It may have (sorry - I've only just noticed the error log as the script runs unattended).

A proof has been supplied.

Using PHP 5.2.2RC2-dev (cli) (built: Apr 12 2007 04:03:00)

Reproduce code:
---------------
<?php
echo 'Current Directory is ', getcwd(), PHP_EOL;
echo 'Path to script is ', dirname($argv[0]), PHP_EOL;
echo 'Change to path of script : ', (chdir(dirname($argv[0])) ? 'Success' : 'Failed'), PHP_EOL;
echo 'Current Directory is ', getcwd(), PHP_EOL;
echo 'Root to path to script is ', dirname(dirname($argv[0])), PHP_EOL;
echo 'Change to root of path of script : ', (chdir(dirname(dirname($argv[0]))) ? 'Success' : 'Failed'), PHP_EOL;
echo 'Current Directory is ', getcwd(), PHP_EOL;
?>

Expected result:
----------------
Current Directory is C:\
Path to script is D:\PHP Quickies
Change to path of script : Success
Current Directory is D:\PHP Quickies
Root to path to script is D:\
Change to root of path of script : Success
Current Directory is D:\


Actual result:
--------------
Current Directory is C:\
Path to script is D:\PHP Quickies
Change to path of script : Success
Current Directory is D:\PHP Quickies
Root to path to script is D:\
Change to root of path of script :
Warning: chdir(): No such file or directory (errno 2) in D:\PHP Quickies\chdir_test.php on line 7
Failed
Current Directory is D:\PHP Quickies

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-12 15:29 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC