Updated stubs, improved PHP7 compatibility

This commit is contained in:
Christopher Vagnetoft
2016-07-21 03:08:06 +02:00
parent 10f4f09a34
commit 9f8cf0bf38
10 changed files with 35 additions and 15 deletions

View File

@ -57,6 +57,7 @@ class Hotfix
break;
case 'php':
$exec = "/usr/bin/env php";
$head = "<?php require_once \"".__DIR__."/../../vendor/autoload.php\"; ".file_get_contents(__DIR__."/../stubs/php.stub");
break;
default:
fprintf(STDERR, "Error: Unsupported language %s\n", $lang);

View File

@ -44,7 +44,11 @@ class Loader
} else {
list ($body, $signature) = explode($sigHeader, $hotfix);
$signature = $sigHeader.$signature;
$signer = $this->verifySignature($body, $signature);
if (!$insecure) {
$signer = $this->verifySignature($body, $signature);
} else {
$signer = null;
}
}
return new Hotfix($body, $signer);
}
@ -64,6 +68,10 @@ class Loader
$fingerprint = $sigInfo[0]['fingerprint'];
$keyInfo = gnupg_keyinfo($gpg, $fingerprint);
if (empty($keyInfo)) {
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
}
$subKeys = $keyInfo[0]['subkeys'];
$keyId = null;
foreach ($subKeys as $subKey) {
@ -73,10 +81,6 @@ class Loader
}
}
if (empty($keyInfo)) {
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
}
return [ $keyInfo[0], $keyId ];
}
}