Bug #77317 [Opn->Asn]: __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive

From: Date: Fri, 21 Dec 2018 22:57:14 +0000
Subject: Bug #77317 [Opn->Asn]: __DIR__, __FILE__, realpath() reveal physical path for subst virtual drive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218562@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77317&edit=1

 ID:                 77317
 Updated by:         cmb@php.net
 Reported by:        mtanalin at yandex dot ru
 Summary:            __DIR__, __FILE__, realpath() reveal physical path
                     for subst virtual drive
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            *Directory/Filesystem functions
 Operating System:   Windows 10
 PHP Version:        7.3.0
-Assigned To:        
+Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

The behavioral change has been introduced with commit f3f6cd2[1].
It seems to me that this change is intentional.  Anatol, if I'm
right, please assign back to me, and I'll add a respective note to
upgrading and the migration guide.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=f3f6cd24e9677c820f198f3804d6c9a932685373>


Previous Comments:
------------------------------------------------------------------------
[2018-12-18 19:51:13] mtanalin at yandex dot ru

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 this bug report at https://bugs.php.net/bug.php?id=77317&edit=1


Thread (6 messages)

« previous php.bugs (#218562) next »