Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PathDownloader.php

function PathDownloader::safeJunctions

Returns true if junctions can be created and safely used on Windows

A PHP bug makes junction detection fragile, leading to possible data loss when removing a package. See https://bugs.php.net/bug.php?id=77552

For safety we require a minimum version of Windows 7, so we can call the system rmdir which will preserve target content if given a junction.

The PHP bug was fixed in 7.2.16 and 7.3.3 (requires at least Windows 7).

1 call to PathDownloader::safeJunctions()
PathDownloader::computeAllowedStrategies in vendor/composer/composer/src/Composer/Downloader/PathDownloader.php
@phpstan-return array{self::STRATEGY_*, non-empty-list<self::STRATEGY_*>}

File

vendor/composer/composer/src/Composer/Downloader/PathDownloader.php, line 328

Class

PathDownloader
Download a package from a local path.

Namespace

Composer\Downloader

Code

private function safeJunctions() : bool {
    // We need to call mklink, and rmdir on Windows 7 (version 6.1)
    return function_exists('proc_open') && (PHP_WINDOWS_VERSION_MAJOR > 6 || PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal