Bug #72367 [NEW]: Relative Drive:path incorrectly assumed to be Drive:/path

From: Date: Thu, 09 Jun 2016 09:38:39 +0000
Subject: Bug #72367 [NEW]: Relative Drive:path incorrectly assumed to be Drive:/path
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201503@lists.php.net to get a copy of this message
From: RQuadling at GMail dot com Operating system: Windows PHP version: 5.6.22 Package: *Directory/Filesystem functions Bug Type: Bug Bug description:Relative Drive:path incorrectly assumed to be Drive:/path Description: ------------ If you use a relative path to a file from Windows command line, PHP interprets the supplied location as a root. The test script below requires a Windows setup with 2 drives (C and D). The script is a batch script that creates the test script and cleans up after itself. Whilst this is similar in some aspects to previously reported bugs related to realpath(), the issue is that the constants __FILE__ and __DIR__ are correct, thus making them useless. OOI, using the absolute path for the PHP script (C:\PHP56\PHP D:\ReaL\PaTH\BuG\TeSTBuG.php), produces the correct results. Test script: --------------- @ECHO OFF REM Make directories for testing. MD C:\Test\Real\PaTH\BuG MD D:\ReaL\PaTH\BuG REM Make test PHP script. ECHO ^<?php > D:\ReaL\PaTH\BuG\TeSTBuG.php ECHO var_export([PHP_VERSION, __FILE__, __DIR__, getcwd(), realpath(__FILE__), realpath(__DIR__), realpath(getcwd()), $argv]);>> D:\ReaL\PaTH\BuG\TeSTBuG.php REM Make sure drives are in their directories. CD /D D:\ReaL\PaTH\BuG CD /D C:\Test\Real\PaTH\BuG REM Call PHP using relative paths. C:\PHP56\PHP D:TeSTBuG.php REM Clean-up DEL D:\ReaL\PaTH\BuG\TeSTBuG.php CD /D D:\ CD /D C:\ RD C:\Test\Real\PaTH\BuG RD D:\ReaL\PaTH\BuG Expected result: ---------------- array ( 0 => '5.6.20', 1 => 'D:\\ReaL\\PaTH\\BuG\\TeSTBuG.php', 2 => 'D:\\ReaL\\PaTH\\BuG', 3 => 'C:\\Test\\Real\\PaTH\\BuG', 4 => D:\\ReaL\\PaTH\\BuG\\TeSTBuG.php, 5 => 'D:\\ReaL\\PaTH\\BuG', 6 => 'C:\\Test\\Real\\PaTH\\BuG', 7 => array ( 0 => 'D:TeSTBuG.php', ), ) Actual result: -------------- array ( 0 => '5.6.20', 1 => 'D:\\TeSTBuG.php', 2 => 'D:\\', 3 => 'C:\\Test\\Real\\PaTH\\BuG', 4 => false, 5 => 'D:\\', 6 => 'C:\\Test\\Real\\PaTH\\BuG', 7 => array ( 0 => 'D:TeSTBuG.php', ), ) -- Edit bug report at https://bugs.php.net/bug.php?id=72367&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72367&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72367&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72367&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72367&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72367&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72367&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72367&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72367&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72367&r=support Expected behavior: https://bugs.php.net/fix.php?id=72367&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72367&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72367&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72367&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72367&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72367&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72367&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72367&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72367&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72367&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72367&r=mysqlcfg

« previous php.bugs (#201503) next »