Signature icon indicating copy to clipboard operation
Signature copied to clipboard

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

Open sebastienbarre opened this issue 5 years ago • 1 comments

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

sebastienbarre avatar Feb 20 '20 19:02 sebastienbarre

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

asgrim avatar Feb 20 '20 19:02 asgrim