File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,8 @@ static zend_function *pgsql_link_get_constructor(zend_object *object) {
172172 return NULL ;
173173}
174174
175+ static void _php_pgsql_notice_handler (void * l , const char * message );
176+
175177static void pgsql_link_free (pgsql_link_handle * link )
176178{
177179 PGresult * res ;
@@ -187,6 +189,12 @@ static void pgsql_link_free(pgsql_link_handle *link)
187189
188190 zend_hash_del (& PGG (connections ), link -> hash );
189191
192+ if (link -> persistent ) {
193+ /* Reset the notice processor context to NULL so that notices emitted
194+ * during a subsequent PQreset on this persistent PGconn are safely
195+ * ignored rather than written to a stale link handle. */
196+ PQsetNoticeProcessor (link -> conn , _php_pgsql_notice_handler , NULL );
197+ }
190198 link -> conn = NULL ;
191199 zend_string_release (link -> hash );
192200
You can’t perform that action at this time.
0 commit comments