Skip to content

open_basedir restriction / fatal error on Windows when username is longer than 8 characters (8.3 short name mismatch) #4080

Description

@karngenie

Quick summary

On Windows, when the logged-in username is longer than 8 characters (e.g. "karngenie"), Windows generates an 8.3 short name for the user profile folder (e.g. "KARNGE~1"). Studio's open_basedir configuration mixes long-form and short-form paths for the same profile directory, causing PHP to fail resolving paths and crash the site with a fatal error. This happens even when the site itself is created outside the user profile, since the issue comes from Studio's own temp/AppData paths, not the site location.

Steps to reproduce

  1. Use a Windows account whose username is longer than 8 characters (plain alphanumeric is enough — length alone triggers Windows' 8.3 short name generation).
  2. Create a new site in Studio (reproduced both under the default C:\Users<username>\Studio... path and under a custom path like C:\Dev\Perso\wp...).
  3. Start the site.

What you expected to happen

The site starts normally. Studio should consistently use either the long-form or short-form path when building the open_basedir list and any related include/require paths, so PHP doesn't fail to resolve legitimate paths due to a mismatch.

What actually happened

The site fails to start with:

Warning: Unknown: open_basedir restriction in effect. File(C:\Users\karngenie) is not within the allowed path(s): (C:\Dev\Perso\wp\mon-merveilleux-site-web;C:\Users\karngenie\AppData\Local\studio_app\app-1.13.0\resources\cli\php\router.php;C:\Users\karngenie\AppData\Local\studio_app\app-1.13.0\resources\cli\wp-files\phpmyadmin;C:\Users\KARNGE1\AppData\Local\Temp\studio-phpmyadmin-wp-env\4088db00-6c85-47e4-a038-c2a367ce9f59\wp-env.php;C:\Users\KARNGE1\AppData\Local\Temp\studio-phpmyadmin-sessions\4088db00-6c85-47e4-a038-c2a367ce9f59;C:\Users\KARNGE1\AppData\Local\Temp\studio-mu-plugins-d19RMd;C:\Users\KARNGE1\AppData\Local\Temp) in Unknown on line 0
Warning: Unknown: Failed to open stream: Operation not permitted in Unknown on line 0
Fatal error: Failed opening required 'C:\Users\KARNGE' (include_path='.;C:\php\pear') in Unknown on line 0

Note the open_basedir list mixes the long-form path (C:\Users\karngenie\AppData...) and the short-form 8.3 path (C:\Users\KARNGE~1\AppData...) for the same directory, and the fatal error tries to open a truncated/malformed path (C:\Users\KARNGE) that doesn't correspond to any real file.

Environment: Studio version 1.13.0, Windows, username length >8 characters (no special characters).

Workarounds found:

  • Moving the site folder outside C:\Users... does NOT fix the issue, since Studio's internal temp/AppData paths still reference the affected profile folder.
  • Disabling 8.3 short name generation (fsutil 8dot3name set c: 1) and removing the existing short name for the profile folder (fsutil file setshortname "C:\Users<username>" "") works around the issue but requires admin rights.
  • Using a Windows account with a username of 8 characters or fewer avoids the issue entirely.

Impact

Some (< 50%)

Available workarounds?

No and the app is unusable

Platform

Windows

Logs or notes

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions