Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug? "Failed to verify the signature of the cached file" when file has a PHP short open tag? #16

Open
sebastienbarre opened this issue Feb 20, 2020 · 1 comment
Labels

Comments

@sebastienbarre
Copy link

Hello

While trying to reflect the cakephp/Debugger.php at 2.x file from CakePHP, I noticed that the class loader kept failing:

Failed to verify the signature of the cached file for Debugger
#0 Vendor/roave/better-reflection/src/Util/Autoload/ClassLoaderMethod/FileCacheLoader.php(66): Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\Exception\SignatureCheckFailed::fromReflectionClass(Object(Roave\BetterReflection\Reflection\ReflectionClass))
Roave/BetterReflection#1 Vendor/roave/better-reflection/src/Util/Autoload/ClassLoader.php(58): Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\FileCacheLoader->__invoke(Object(Roave\BetterReflection\Reflection\ReflectionClass))
Roave/BetterReflection#2 [internal function]: Roave\BetterReflection\Util\Autoload\ClassLoader->__invoke('Debugger')

We have been able to reflect other classes in this directory, so this was surprising. I started removing parts of that file manually, until I found the culprit:

protected static function _highlight($str) {
...
		if (strpos($str, '<?php') === false) {
			$added = true;
			$str = "<?php \n" . $str;
		}
...

These 3 lines seem to be preventing reflection, and I assume the PHP short open tags might to blame? Is this expected?

Removing these lines or the entire _highlight function will prevent the Failed to verify the signature of the cached file from happening.

Thank you

@asgrim asgrim transferred this issue from Roave/BetterReflection Feb 20, 2020
@asgrim
Copy link
Member

asgrim commented Feb 20, 2020

Looks like this is a bug in underlying library roave/signature. Moved this issue there.

@asgrim asgrim added the bug label Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants