php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61441 readlink returns operating system specific directory separators in result
Submitted: 2012-03-19 18:57 UTC Modified: 2012-03-20 21:07 UTC
From: daveespionage at gmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.3.10 OS: Windows 7 64 bit
Private report: No CVE-ID: None
 [2012-03-19 18:57 UTC] daveespionage at gmail dot com
Description:
------------
readlink when called on a directory symlink in Windows 7 returns directory 
separators of '\', whereas seemingly most other filesystem functions return 
directory separators of '/' regardless of host operating system.

Test script:
---------------
<?php
	echo 'Docroot: ' . $_SERVER['DOCUMENT_ROOT'] . '<br />';
	echo 'Readlink: ' . readlink($_SERVER['DOCUMENT_ROOT']) . '<br />';
?>

Expected result:
----------------
Docroot: C:/sites/project
Readlink: C:/work/Project/wwwroot

Actual result:
--------------
Docroot: C:/sites/project
Readlink: C:\work\Project\wwwroot

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-19 19:02 UTC] daveespionage at gmail dot com
I should have clarified in the description, $_SERVER['DOCUMENT_ROOT'] in this case 
is pointed to a directory symlink created with 'mklink /D', that has the alias 
'c:\sites\project' and resolves to 'c:\work\Project\wwwroot'
 [2012-03-20 10:06 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 [2012-03-20 10:06 UTC] pajoye@php.net
Expected behavior. All files operations working with paths to clean or resolve 
them returns the OS specific directory separator.
 [2012-03-20 21:07 UTC] daveespionage at gmail dot com
@pajoye: Is this in the PHP documentation anywhere?  I cannot find it in 
http://php.net/manual/en/function.readlink.php or the parent 
http://www.php.net/manual/en/ref.filesystem.php

Should I file a missing documentation bug?

Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 10:01:31 2024 UTC