<email>mike@php.net</email>
<active>yes</active>
</lead>
- <date>2016-01-19</date>
+ <date>2016-04-28</date>
<version>
<release>2.0.1dev</release>
<api>2.0.0</api>
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-*
+* Fixed pointless initialization of persistent handles lists on cleanup
]]></notes>
<contents>
<dir name="/">
}
static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
- php_persistent_handle_provider_t *provider, zend_string *ident)
+ php_persistent_handle_provider_t *provider, zend_string *ident,
+ zend_bool create)
{
php_persistent_handle_list_t *list;
zval *zlist = zend_symtable_find(&provider->list.free, ident);
return list;
}
- if ((list = php_persistent_handle_list_init(NULL))) {
+ if (create && (list = php_persistent_handle_list_init(NULL))) {
zval p, *rv;
zend_string *id;
php_persistent_handle_list_t *list;
if (ident && ident->len) {
- if ((list = php_persistent_handle_list_find(provider, ident))) {
+ if ((list = php_persistent_handle_list_find(provider, ident, 0))) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
&provider->rf);
void *handle = NULL;
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
zend_hash_internal_pointer_end(&list->free);
key = zend_hash_get_current_key(&list->free, NULL, &index);
new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
if (handle) {
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
++list->used;
}
{
php_persistent_handle_list_t *list;
- list = php_persistent_handle_list_find(a->provider, a->ident);
+ list = php_persistent_handle_list_find(a->provider, a->ident, 1);
if (list) {
if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
#if PHP_RAPHF_DEBUG_PHANDLES
if (zprovider && (provider = Z_PTR_P(zprovider))) {
if (ident) {
- list = php_persistent_handle_list_find(provider, ident);
+ list = php_persistent_handle_list_find(provider, ident, 0);
if (list) {
zend_hash_apply_with_argument(&list->free,
php_persistent_handle_apply_cleanup_ex,
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-$c = new http\Client("curl", "php.net:80");
+$c = new http\Client("curl", "PHP");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(1)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(3)
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(0)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(0)
<?php
echo "Test\n";
-$c = new http\Client("curl", "php.net:80");
+$c = new http\Client("curl", "PHP");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
raphf\clean_persistent_handles("http\\Client\\Curl");
-raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
+raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "PHP:php.net:80");
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(0)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(0)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(0)
<?php
echo "Test\n";
-$c = new http\Client("curl", "php.net:80");
+$c = new http\Client("curl", "PHP");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
} while (count($c) < 3);
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-raphf\clean_persistent_handles(null, "php.net:80");
+raphf\clean_persistent_handles(null, "PHP");
+raphf\clean_persistent_handles(null, "PHP:php.net:80");
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(0)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(0)
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(0)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(0)
$h = (array) raphf\stat_persistent_handles();
var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-$c = new http\Client("curl", "php.net:80");
-$c2 = new http\Client("curl", "php.net:80");
+$c = new http\Client("curl", "PHP");
+$c2 = new http\Client("curl", "PHP");
do {
$c->enqueue(new http\Client\Request("GET", "http://php.net"));
$c2->enqueue(new http\Client\Request("GET", "http://php.net"));
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(2)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(6)
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(1)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(3)
array(2) {
["http\Client\Curl"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP"]=>
array(2) {
["used"]=>
int(1)
}
["http\Client\Curl\Request"]=>
array(1) {
- ["php.net:80"]=>
+ ["PHP:php.net:80"]=>
array(2) {
["used"]=>
int(3)