str_starts_with($path, '/') does not correctly detect absolute paths on Windows

Created on 2 May 2023, over 1 year ago
Updated 4 May 2023, over 1 year ago

Problem/Motivation

Spotted in 📌 Decide which classes should be internal and/or final — delete ExcludedPathsTrait, make CollectPathsToExcludeEvent richer Fixed .

@phenaproxima discovered a huge bug wrt Windows support: https://git.drupalcode.org/project/automatic_updates/-/merge_requests/79...

Proposed resolution

We shouldn't be doing this by looking at the string. There are functions out there which can detect an absolute path reliably.

I would suggest using \PhpTuf\ComposerStager\Domain\Value\Path\PathInterface::isAbsolute(). Take the path you're given and use the path factory to create a PathInterface object for it, then call that object's isAbsolute() method.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Package Manager

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024