Signature
Signature copied to clipboard
Bug? "Failed to verify the signature of the cached file" when file has a PHP short open tag?
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
Looks like this is a bug in underlying library roave/signature. Moved this issue there.