mirror of
https://github.com/php/php-src.git
synced 2024-12-20 15:30:38 +08:00
Revert "Revert "Fixed warning "(null)(): supplied resource is not a valid cURL handle resource in Unknown on line 0"""
This reverts commit e78dd7ade2
.
This commit is contained in:
parent
bf55a4e223
commit
c9e44dc2df
@ -105,6 +105,10 @@ void _php_curl_multi_cleanup_list(void *data) /* {{{ */
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_RES_P(z_ch)->ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ch = zend_fetch_resource(z_ch, -1, le_curl_name, NULL, 1, le_curl);
|
||||
if (!ch) {
|
||||
return;
|
||||
@ -341,9 +345,11 @@ void _php_curl_multi_close(zend_resource *rsrc) /* {{{ */
|
||||
|
||||
for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
|
||||
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
|
||||
|
||||
ch = (php_curl *) zend_fetch_resource(pz_ch, -1, le_curl_name, NULL, 1, le_curl);
|
||||
_php_curl_verify_handlers(ch, 0);
|
||||
/* ptr is NULL means it already be freed */
|
||||
if (Z_RES_P(pz_ch)->ptr) {
|
||||
ch = (php_curl *) zend_fetch_resource(pz_ch, -1, le_curl_name, NULL, 1, le_curl);
|
||||
_php_curl_verify_handlers(ch, 0);
|
||||
}
|
||||
}
|
||||
|
||||
curl_multi_cleanup(mh->multi);
|
||||
|
20
ext/curl/tests/curl_multi_close_reference.phpt
Normal file
20
ext/curl/tests/curl_multi_close_reference.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
curl_multi_close closed by cleanup functions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) print 'skip';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$mh = curl_multi_init();
|
||||
$array = array($mh);
|
||||
$array[] = &$array;
|
||||
|
||||
curl_multi_add_handle($mh, curl_init());
|
||||
curl_multi_add_handle($mh, curl_init());
|
||||
curl_multi_add_handle($mh, curl_init());
|
||||
curl_multi_add_handle($mh, curl_init());
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECT--
|
||||
okey
|
Loading…
Reference in New Issue
Block a user