Skip to content

Commit

Permalink
Fixed undefined variable in phar stub, close #23
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Dec 4, 2017
1 parent 69d3979 commit 70b3bf7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/DevTools/ConsoleScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,24 @@
"creationDate" => time()
]);

$phar->setStub('<?php echo "PocketMine-MP plugin ' . $metadata["name"] . ' v' . $metadata["version"] . '\nThis file has been generated using DevTools v" . $version . " at ' . date("r") . '\n----------------\n";if(extension_loaded("phar")){$phar = new \Phar(__FILE__);foreach($phar->getMetadata() as $key => $value){echo ucfirst($key).": ".(is_array($value) ? implode(", ", $value):$value)."\n";}} __HALT_COMPILER();');
$stub = '
<?php
echo "PocketMine-MP plugin %s v%s
This file has been generated using DevTools v%s at %s
----------------
";
if(extension_loaded("phar")){
$phar = new \Phar(__FILE__);
foreach($phar->getMetadata() as $key => $value){
echo ucfirst($key) . ": " . (is_array($value) ? implode(", ", $value) : $value) . "\n";
}
}
__HALT_COMPILER();
';

$phar->setStub(sprintf($stub, $metadata["name"], $metadata["version"], VERSION, date("r")));
}

$phar->setSignatureAlgorithm(\Phar::SHA1);
Expand Down

0 comments on commit 70b3bf7

Please sign in to comment.