php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #79795 Support SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
Submitted: 2020-07-05 02:12 UTC Modified: 2020-07-20 13:01 UTC
From: svnpenn at gmail dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: Next Minor Version OS: Windows 10
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: svnpenn at gmail dot com
New email:
PHP Version: OS:

 

 [2020-07-05 02:12 UTC] svnpenn at gmail dot com
Description:
------------
Windows SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE

Using this file:

    <?php
    symlink('a.php', 'b.php');

I get this result:

    PS C:\php> php a.php
    Warning: symlink(): Permission denied in C:\php\a.php on line 2

I am not running as admin, but I do have developer mode enabled:

<https://howtogeek.com/292914/what-is-developer-mode-in-windows-10>

Since December 2016, admin rights are not required to create a symlink, as long
as the application uses the flag `SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE`:

<https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10>

Note that other programming languages are already doing this. For example
Python:

<https://github.com/python/cpython/blob/1f764531/Modules/winreparse.h#L50>

Dart:

<https://github.com/dart-lang/sdk/blob/a677c245/runtime/bin/file_win.cc#L430>

Go:

<https://github.com/golang/go/blob/dd150176/src/internal/syscall/windows/symlink_windows.go#L13>

Nim:

<https://github.com/nim-lang/Nim/blob/af27e6bd/lib/pure/os.nim#L2417-L2419>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-05 03:14 UTC] requinix@php.net
-Summary: Windows SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE +Summary: Support SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE -Type: Bug +Type: Feature/Change Request
 [2020-07-06 08:08 UTC] cmb@php.net
-PHP Version: 7.4.7 +PHP Version: Next Minor Version
 [2020-07-20 13:01 UTC] cmb@php.net
Makes sense to me.  A pull request would be welcome.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC