zend_list_close() returns void starting in php 8 beta3 (#1184)
This commit is contained in:
parent
9f1f27ec79
commit
f2cae4c34f
|
@ -812,9 +812,13 @@ PHP_FUNCTION( sqlsrv_close )
|
||||||
// cause any variables still holding a reference to this to be invalid so they cause
|
// cause any variables still holding a reference to this to be invalid so they cause
|
||||||
// an error when passed to a sqlsrv function. There's nothing we can do if the
|
// an error when passed to a sqlsrv function. There's nothing we can do if the
|
||||||
// removal fails, so we just log it and move on.
|
// removal fails, so we just log it and move on.
|
||||||
if( zend_list_close( Z_RES_P( conn_r ) ) == FAILURE ) {
|
#if PHP_VERSION_ID < 80000
|
||||||
LOG( SEV_ERROR, "Failed to remove connection resource %1!d!", Z_RES_HANDLE_P( conn_r ));
|
if (zend_list_close(Z_RES_P(conn_r)) == FAILURE) {
|
||||||
|
LOG(SEV_ERROR, "Failed to remove connection resource %1!d!", Z_RES_HANDLE_P(conn_r));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
zend_list_close(Z_RES_P(conn_r));
|
||||||
|
#endif
|
||||||
|
|
||||||
// when conn_r is first parsed in zend_parse_parameters, conn_r becomes a zval that points to a zend_resource with a refcount of 2
|
// when conn_r is first parsed in zend_parse_parameters, conn_r becomes a zval that points to a zend_resource with a refcount of 2
|
||||||
// need to DELREF here so the refcount becomes 1 and conn_r can be appropriate destroyed by the garbage collector when it goes out of scope
|
// need to DELREF here so the refcount becomes 1 and conn_r can be appropriate destroyed by the garbage collector when it goes out of scope
|
||||||
|
@ -1265,9 +1269,14 @@ PHP_FUNCTION( sqlsrv_query )
|
||||||
|
|
||||||
void free_stmt_resource( _Inout_ zval* stmt_z )
|
void free_stmt_resource( _Inout_ zval* stmt_z )
|
||||||
{
|
{
|
||||||
if( FAILURE == zend_list_close( Z_RES_P( stmt_z ))) {
|
#if PHP_VERSION_ID < 80000
|
||||||
|
if (FAILURE == zend_list_close(Z_RES_P(stmt_z))) {
|
||||||
LOG(SEV_ERROR, "Failed to remove stmt resource %1!d!", Z_RES_HANDLE_P(stmt_z));
|
LOG(SEV_ERROR, "Failed to remove stmt resource %1!d!", Z_RES_HANDLE_P(stmt_z));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
zend_list_close(Z_RES_P(stmt_z));
|
||||||
|
#endif
|
||||||
|
|
||||||
ZVAL_NULL( stmt_z );
|
ZVAL_NULL( stmt_z );
|
||||||
zval_ptr_dtor(stmt_z);
|
zval_ptr_dtor(stmt_z);
|
||||||
}
|
}
|
||||||
|
@ -1317,9 +1326,13 @@ void sqlsrv_conn_close_stmts( _Inout_ ss_sqlsrv_conn* conn )
|
||||||
|
|
||||||
// this would call the destructor on the statement.
|
// this would call the destructor on the statement.
|
||||||
// There's nothing we can do if the removal fails, so we just log it and move on.
|
// There's nothing we can do if the removal fails, so we just log it and move on.
|
||||||
if( zend_list_close( Z_RES_P(rsrc_ptr) ) == FAILURE ) {
|
#if PHP_VERSION_ID < 80000
|
||||||
|
if (zend_list_close(Z_RES_P(rsrc_ptr)) == FAILURE) {
|
||||||
LOG(SEV_ERROR, "Failed to remove statement resource %1!d! when closing the connection", Z_RES_HANDLE_P(rsrc_ptr));
|
LOG(SEV_ERROR, "Failed to remove statement resource %1!d! when closing the connection", Z_RES_HANDLE_P(rsrc_ptr));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
zend_list_close(Z_RES_P(rsrc_ptr));
|
||||||
|
#endif
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
|
||||||
zend_hash_destroy( conn->stmts );
|
zend_hash_destroy( conn->stmts );
|
||||||
|
|
|
@ -1396,9 +1396,13 @@ PHP_FUNCTION( sqlsrv_free_stmt )
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the resource from Zend's master list, which will trigger the statement's destructor
|
// delete the resource from Zend's master list, which will trigger the statement's destructor
|
||||||
if( zend_list_close( Z_RES_P(stmt_r) ) == FAILURE ) {
|
#if PHP_VERSION_ID < 80000
|
||||||
LOG( SEV_ERROR, "Failed to remove stmt resource %1!d!", Z_RES_P( stmt_r )->handle);
|
if (zend_list_close(Z_RES_P(stmt_r)) == FAILURE) {
|
||||||
|
LOG(SEV_ERROR, "Failed to remove stmt resource %1!d!", Z_RES_P(stmt_r)->handle);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
zend_list_close(Z_RES_P(stmt_r));
|
||||||
|
#endif
|
||||||
|
|
||||||
// when stmt_r is first parsed in zend_parse_parameters, stmt_r becomes a zval that points to a zend_resource with a refcount of 2
|
// when stmt_r is first parsed in zend_parse_parameters, stmt_r becomes a zval that points to a zend_resource with a refcount of 2
|
||||||
// need to DELREF here so the refcount becomes 1 and stmt_r can be appropriate destroyed by the garbage collector when it goes out of scope
|
// need to DELREF here so the refcount becomes 1 and stmt_r can be appropriate destroyed by the garbage collector when it goes out of scope
|
||||||
|
|
Loading…
Reference in a new issue