Skip to content

Commit 6414d18

Browse files
committed
pgsqlSetNoticeCallback: accept closure callbacks
Fix to what @ranvis noted in #4823 (comment)
1 parent 6bdac76 commit 6414d18

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in
136136
static void pdo_pgsql_cleanup_notice_callback(pdo_pgsql_db_handle *H) /* {{{ */
137137
{
138138
if (H->notice_callback) {
139+
zval_ptr_dtor(&H->notice_callback->fci.function_name);
139140
efree(H->notice_callback);
140141
H->notice_callback = NULL;
141142
}
@@ -1176,6 +1177,7 @@ static PHP_METHOD(PDO, pgsqlSetNoticeCallback)
11761177
if (!(fc = H->notice_callback)) {
11771178
fc = (pdo_pgsql_fci*)ecalloc(1, sizeof(pdo_pgsql_fci));
11781179
} else {
1180+
zval_ptr_dtor(&fc->fci.function_name);
11791181
memcpy(&fc->fcc, &empty_fcall_info_cache, sizeof(fc->fcc));
11801182
}
11811183

@@ -1186,6 +1188,7 @@ static PHP_METHOD(PDO, pgsqlSetNoticeCallback)
11861188
H->notice_callback = NULL;
11871189
RETURN_FALSE;
11881190
}
1191+
Z_ADDREF_P(&fc->fci.function_name);
11891192
zend_string_release_ex(cbname, 0);
11901193

11911194
H->notice_callback = fc;

0 commit comments

Comments
 (0)