Permalink
Browse files

Fixing cacert in phar stub

  • Loading branch information...
1 parent d623ebd commit a0128eb65b82c58f5803b631f70137725e9e587f @mtdowling mtdowling committed Apr 28, 2014
Showing with 12 additions and 0 deletions.
  1. +12 −0 build/phar-stub.php
View
@@ -19,6 +19,18 @@
define('AWS_PHAR', true);
define('AWS_FILE_PREFIX', 'phar://aws.phar');
+// Copy the cacert.pem file from the phar if it is not in the temp folder.
+$from = 'phar://aws.phar/Guzzle/Http/Resources/cacert.pem';
+$certFile = sys_get_temp_dir() . '/guzzle-cacert.pem';
+
+// Only copy when the file size is different
+if (!file_exists($certFile) || filesize($certFile) != filesize($from)) {
+ if (!copy($from, $certFile)) {
+ throw new RuntimeException("Could not copy {$from} to {$certFile}: "
+ . var_export(error_get_last(), true));
+ }
+}
+
return (require 'phar://aws.phar/aws-autoloader.php');
__HALT_COMPILER();

0 comments on commit a0128eb

Please sign in to comment.