Bug #74563 [NEW]: curl_exec() throws internal error in curl_error()
| From: | jeremys at ha dot com | Date: | Tue, 09 May 2017 13:58:32 +0000 |
| Subject: | Bug #74563 [NEW]: curl_exec() throws internal error in curl_error() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209027@lists.php.net to get a copy of this message | ||
From: jeremys at ha dot com
Operating system: RHEL 7.3
PHP version: 7.1.4
Package: cURL related
Bug Type: Bug
Bug description:curl_exec() throws internal error in curl_error()
Description:
------------
Executing curl_exec() with a host/URL that refuses the connection makes
curl_exec() sometimes raise an E_WARNING because curl_exec() calls
curl_error() internally. The error is as follows:
curl_error() expects parameter 1 to be resource, boolean given
As you can see in the sample script, there is no explicit call to
curl_error(), yet the above error is seen.
I've only been able to reproduce via Apache, not via cli.
Apache/2.4.6 (Red Hat Enterprise Linux)
PHP 7.1.3 (part of Zend Server 9.1) - I assume 7.1.4 as well since there
are no relevant changes to the curl interface in the PHP source code
libcurl 7.29.0
Test script:
---------------
<?php
ini_set( 'display_errors', 1 );
ini_set( 'error_reporting', E_ALL );
set_error_handler( function ( ...$error ) {
array_pop( $error );
print_r( $error );
die();
});
$resource = curl_init();
curl_setopt( $resource, CURLOPT_URL, 'http://127.0.0.1:1' );
curl_setopt( $resource, CURLOPT_RETURNTRANSFER, 1 );
curl_exec( $resource );
echo 'Script finished.';
Expected result:
----------------
Script finished.
Actual result:
--------------
Array
(
[0] => 2
[1] => curl_error() expects parameter 1 to be resource, boolean
given
[2] => /usr/local/apache/htdocs2/curl-error-test.php
[3] => 16
)
--
Edit bug report at https://bugs.php.net/bug.php?id=74563&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74563&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74563&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74563&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74563&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74563&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74563&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74563&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74563&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74563&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74563&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74563&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74563&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74563&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74563&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74563&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74563&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74563&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74563&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74563&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74563&r=mysqlcfg