Skip to content

Use symfony/filesystem instead of native filesystem functions - #147

Merged
pyrech merged 1 commit into
mainfrom
use-symfony-filesystem
Sep 29, 2026
Merged

pyrech merged 1 commit into
mainfrom
use-symfony-filesystem

Conversation

@lyrixx

@lyrixx lyrixx commented Sep 29, 2026

Copy link
Copy Markdown
Member

Now that symfony/filesystem is a dependency, use it where it makes sense.

PharExtractor

  • @mkdir() → Filesystem::mkdir(), errors are caught and the resulting directory is still validated with lstat() (real directory, 0700, owned by the current user)
  • touch() → Filesystem::touch(), a failure is caught so it can never break the host application (Notification only catches PharExtractionException)
  • file_exists() → Filesystem::exists()

Tests

  • mkdir(), chmod(), symlink(), touch(), file_put_contents() and copy() replaced by their Filesystem equivalents
  • The PHAR test bootstrap now also loads the filesystem exception classes

Left untouched

  • realpath() in Notification: Path::canonicalize() does not resolve symlinks
  • scandir(), filemtime(), lstat(), flock(), tmpfile(): no equivalent
  • Path building with Path::join(): it would turn \ into / on Windows and change the returned paths
  • The jolinotif binary: it runs before the autoloader is loaded

@pyrech pyrech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@pyrech
pyrech merged commit dc0535e into main Sep 29, 2026
8 checks passed
@pyrech
pyrech deleted the use-symfony-filesystem branch September 29, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants