Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AnnotationFileLoader breaks on OSX Mounted Drives in Symfony 3.2.0 #21497

Closed
@kphamilton

Description

@kphamilton
Q A
Bug report? yes
Feature request?
BC Break report? yes
RFC?
Symfony version 3.2.0

I develop in my local environment on OSX using a mounted network drive that is my Linux VM.

Some of you might know that OSX handles files and metadata from mounted drives in an interesting way. It creates an ".AppleDouble" directory, and then creates files in that directory that match the names of the parent directory (ie, Controller/BlogController.php and it creates Controller/.AppleDouble/BlogController.php that contains the metadata).

These files store encoded data about the original files. Because of that, they do not contain a php start tag (<?php)

I updated to Symfony 3.2.0 this morning and started receiving this exception:

The file "/path/Controller/.AppleDouble/BlogController.php" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?

Everything works in 3.1.* and upon further examination, the change causing this was in PR #18869

That change occurred to assist in people who had copied and pasted code from a tutorial that did not have a start tag. Instead of it silently failing, it now throws an exception in the findClass() method of the AnnotationFileLoader to give a clearer reason why it failed.

The situation is that now it is attempting to load the ".php" files in my .AppleDouble directories, assuming they are actual PHP files, and it is not able to find a start tag, so an exception is thrown. In the past, it would simply not load those files, and my application would work.

I would rather not have to create a custom loader to get around this. Any thoughts or suggestions on what I can do? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions