Skip to content

Loading…

DCOM-204: AnnotationDriver cannot find classes inside Phar files #509

Closed
doctrinebot opened this Issue · 1 comment

2 participants

@doctrinebot

Jira issue originally created by user jgroth:

If an application is packaged inside a Phar file, the annotation driver cannot find any classes. The problem is in the method AnnotationDriver::getAllClassNames()

foreach ($iterator as $file) {
    $sourceFile = realpath($file[0]);

    require_once $sourceFile;

    $includedFiles[] = $sourceFile;
}

$iterator will hold all paths to the files found, however realpath() will return false since the files are inside a phar file.

I have solved this locally in my application with the following, however I'm not sure if this is the right approach to solve the problem.

$sourceFile = str_replace('\\', '/', $file[0]);
if (!preg_match('#^phar://#i', $sourceFile)) {
    $sourceFile = realpath($sourceFile);
}
@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.4.2 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.