Bug #77317 [NEW]: __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive

From: Date: Tue, 18 Dec 2018 19:51:13 +0000
Subject: Bug #77317 [NEW]: __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218513@lists.php.net to get a copy of this message
From:             mtanalin at yandex dot ru
Operating system: Windows 10
PHP version:      7.3.0
Package:          *Directory/Filesystem functions
Bug Type:         Bug
Bug description:__DIR__, __FILE__, realpath() reveal physical path for subst virtual drive

Description:
------------
__DIR__, __FILE__ and realpath() now reveal physical path for
virtual drives created with subst under Windows. This is a breaking
backward-incompatible change.

The Windows’ built-in subst application maps a physical directory to
a virtual drive and is used by Denwer for creating a virtual drive that
web servers are virtually located on. Denwer is a WAMP kit popular in
Russia.

Documentation pages for __DIR__, __FILE__ and realpath() have
no
information about this change.

PHP 7.2.12 works as expected: virtual-drive path is returned, physical
path is not revealed.

So either the behavior in PHP 7.3.x should be the same as in PHP 7.2.x
(virtual-drive path returned, physical-drive path not revealed), or this
breaking change should be documented.

For example, in PHP 7.3.0 (with the latest Apache 2.4.37 [2018-11-21]
from Apache Lounge):

	__DIR__:
		D:\_webservers\home\test-host

	__FILE__:
		D:\_webservers\home\test-host\test.php

	$_SERVER['DOCUMENT_ROOT']:
		Z:/home/test-host/www

	realpath($_SERVER['DOCUMENT_ROOT']):
		D:\_webservers\home\test-host\www

While in PHP 7.2.12:

	__DIR__:
		Z:\home\test-host

	__FILE__:
		Z:\home\test-host\test.php

	$_SERVER['DOCUMENT_ROOT']:
		Z:/home/test-host/www

	realpath($_SERVER['DOCUMENT_ROOT']):
		Z:\home\test-host\www


Test script:
---------------
<?php

echo __DIR__ . '<br>'
   . __FILE__ . '<br>'
   . $_SERVER['DOCUMENT_ROOT'] . '<br>'
   . realpath($_SERVER['DOCUMENT_ROOT']);


-- 
Edit bug report at https://bugs.php.net/bug.php?id=77317&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77317&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77317&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77317&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77317&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77317&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77317&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77317&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77317&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77317&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77317&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77317&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77317&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77317&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77317&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77317&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77317&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77317&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77317&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77317&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77317&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#218513) next »