Bug #69035 [NEW]: curl error setting CURLOPT_CAINFO .crt file inside PHAR
| From: | sebastian at phpbu dot de | Date: | Thu, 12 Feb 2015 07:44:30 +0000 |
| Subject: | Bug #69035 [NEW]: curl error setting CURLOPT_CAINFO .crt file inside PHAR | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-190602@lists.php.net to get a copy of this message | ||
From: sebastian at phpbu dot de
Operating system: Linux (Debian Wheezy)
PHP version: 5.6.5
Package: cURL related
Bug Type: Bug
Bug description:curl error setting CURLOPT_CAINFO .crt file inside PHAR
Description:
------------
The Error occures if you create a PHAR with a .crt file in it.
Setting the CURLOPT_CAINFO option and linking a .crt file within the
phar
leads to an error like this
Curl failed to exec error setting certificate verify locations:
CAfile: phar:///tmp/my.phar/demo/ca.crt
CApath: /etc/ssl/certs
'
in phar:///tmp/my.phar/demo/example.php:9
Setting CURLOPT_CAPATH to __DIR__ doesn't help either.
Dumping the .crt file to stdOut works in phar mode so the file is
there.
Not compiled to phar the code works fine.
Using:
PHP 5.6.5
curl 7.26.0 (x86_64-pc-linux-gnu) libcurl/7.26.0 OpenSSL/1.0.1e
zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
Test script:
---------------
<?php
// curl setup
$handle = curl_init();
$caFile = __DIR__ . '/ca.crt';
// check for crt file just to make sure its in the phar
if (!is_file($caFile)) {
throw new Exception("Failed to load ca certificate");
}
curl_setopt($handle, CURLOPT_CAINFO, $caFile);
// optionaly use this as well
//curl_setopt($handle, CURLOPT_CAPATH, __DIR__);
// make phar file containing this and a .crt file
// contents of .crt doesn't matter for demonstration
Expected result:
----------------
In a PHAR I want to link curl to .crt files i provide within the phar.
Actual result:
--------------
Curl can't access the .crt file within the phar
Curl failed to exec error setting certificate verify locations:
CAfile: phar:///tmp/my.phar/demo/ca.crt
--
Edit bug report at https://bugs.php.net/bug.php?id=69035&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69035&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69035&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69035&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69035&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69035&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69035&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69035&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69035&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69035&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69035&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69035&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69035&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69035&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69035&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69035&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69035&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69035&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69035&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69035&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69035&r=mysqlcfg