summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-11-01 15:19:31 +0300
committerDmitry Stogov <dmitry@zend.com>2017-11-01 15:19:31 +0300
commit67d5f39a47b15e28293d9d6558b80ded049179fe (patch)
treee8f11a2a68bb06f259e8e3eeed5b102884df9fa6 /ext/pgsql/pgsql.c
parentf5664a149260ed4a83aa5cfb13ad11ed18c56af6 (diff)
downloadphp-git-67d5f39a47b15e28293d9d6558b80ded049179fe.tar.gz
Persistent resources are "thread-local".
Register persistent resources through new functions zend_register_persistent_resource()/zend_register_persistent_resource_ex().
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index f1bc779cfe..286c862885 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1357,8 +1357,6 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* try to find if we already have this link in our persistent list */
if ((le = zend_hash_find_ptr(&EG(persistent_list), str.s)) == NULL) { /* we don't */
- zend_resource new_le;
-
if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) {
php_error_docref(NULL, E_WARNING,
"Cannot create new link. Too many open links (" ZEND_LONG_FMT ")", PGG(num_links));
@@ -1385,9 +1383,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
/* hash it up */
- new_le.type = le_plink;
- new_le.ptr = pgsql;
- if (zend_hash_str_update_mem(&EG(persistent_list), ZSTR_VAL(str.s), ZSTR_LEN(str.s), &new_le, sizeof(zend_resource)) == NULL) {
+ if (zend_register_persistent_resource(ZSTR_VAL(str.s), ZSTR_LEN(str.s), pgsql, le_plink) == NULL) {
goto err;
}
PGG(num_links)++;