php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47767 include_once does not resolve windows symlinks or junctions
Submitted: 2009-03-24 22:43 UTC Modified: 2019-11-17 04:26 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:6 of 6 (100.0%)
Same Version:5 (83.3%)
Same OS:5 (83.3%)
From: lukemoynihan at gmail dot com Assigned: pajoye (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3 OS: win32 only - Windows Vista
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: lukemoynihan at gmail dot com
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2009-03-24 22:43 UTC] lukemoynihan at gmail dot com
Description:
------------
PHP does not resolve symlinks (On Vista) or Junctions (windows 2000) 
on windows when including files

Create index.php and test.php as shown below, then create a symlink 
on Vista using:

mklink test2.php test.php

Note: this test case illustrates symlinks, but that Junctions created 
on NTFS volumes also have this problem.

Reproduce code:
---------------
index.php:

<?php
include_once('test.php');
include_once('test2.php');
include_once('test2.php');

test.php:

<?php
echo "i'm included ";

Expected result:
----------------
Expected on Linux:

i'm included

Expected on Windows:

i'm included

Actual result:
--------------
Actual on Linux:

i'm included

Actual on Windows:

i'm included i'm included

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-24 22:55 UTC] pajoye@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-03-25 02:09 UTC] lukemoynihan at gmail dot com
I can confirm this is a problem using 
http://windows.php.net/downloads/snaps/php-5.3-nts-win32-VC9-x86-
latest.zip  that i downloaded now. 

The problem occurs when the symlink (typically used by Vista/Server 
2008) is a folder or a file, or a folder junction (Used by WinXP/2K) 
is used.
 [2009-03-25 02:15 UTC] lukemoynihan at gmail dot com
FYI: I've tested this on Windows XP, Vista to get the results for 
windows, and Centos 5 for linux results
 [2009-03-25 10:51 UTC] andrew at mcgl dot co dot nz
Have the same problem on V5.2.8 running on windows XP
 [2009-03-25 11:13 UTC] pajoye@php.net
Ok, will see what can be done for symlink. I'm not sure 2k/xp are worst a hack, but 2k8/vista/win7 have real symlinks support.
 [2009-03-26 02:47 UTC] lukemoynihan at gmail dot com
Ok, I can understand not wanting to support Junctions, It would be 
fantastic to support symlinks though - this is bound to come up more 
as people on windows learn to use links, if you need any testing done 
for this let me know.
 [2009-06-16 00:21 UTC] pajoye@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-06-17 12:43 UTC] martin at curlybracket dot de
I've just checked the snapshot
PHP 5.3 (5.3.0RC4-dev) VC6 x86 Non Thread Safe (2009-Jun-17 13:00:00)
 (Zip, sha1: 269d823708ed9bec3cd4ab5ca563245ed6aed820)
and neither symlink nor junction is working for me. My scenario is a bit different, i'm linking not a file but a directory:

D:\dev\lib is the target.
D:\dev\link is the symlink/junction.

When i try to include the file D:\dev\link\test.php i get the following error:

------------
Warning: include_once(D:\dev\link\test.php) [function.include-once]: failed to open stream: No such file or directory in D:\dev\test-47767.php on line 2

Fatal error: include_once() [function.include]: Failed opening required 'D:\dev\link\test.php' (include_path='.') in D:\dev\test-47767.php on line 2
------------

is_file('D:\dev\link\test.php') returns true and an include to D:\dev\lib\test.php is working correctly.
 [2009-06-17 19:37 UTC] pajoye@php.net
Does it work for you for symlinked files? Or does it fail too?
 [2009-06-21 18:59 UTC] martin at curlybracket dot de
I've tryed symlinked files and that is working for me, you're right. So, maybe the symlinked directory thing is another but related bug, right? I've also tryed the latest snapshot, but the problem is the same for me.
 [2009-06-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-07-07 02:54 UTC] mario at unosquare dot com
5.3 does not support folder junctions. It used to be fine in 5.2.9-2 but now, with 5.3 it is not resolving the includes/requires.
 [2009-07-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-10 10:40 UTC] giunta dot gaetano at gmail dot com
Besdides include/require, file_exist() calls also fail for files that are found in a dir that is a junction point
 [2009-08-26 20:52 UTC] pajoye@php.net
Please also follow #48746, it could be the same problem. I close (bogus) this bug to avoid to have to split the info in too many reports.
 [2019-11-17 04:26 UTC] requinix@php.net
-Block user comment: No +Block user comment: Yes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC