Skip to content

Commit 55618ff

Browse files
committed
Convert infallible mysqli checks to asserts
1 parent 307dd46 commit 55618ff

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

ext/mysqli/php_mysqli_structs.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,13 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
273273
#define MYSQLI_FETCH_RESOURCE_CONN(__ptr, __id, __check) \
274274
{ \
275275
MYSQLI_FETCH_RESOURCE((__ptr), MY_MYSQL *, (__id), "mysqli_link", (__check)); \
276-
if (!(__ptr)->mysql) { \
277-
mysqli_object *intern = Z_MYSQLI_P(__id); \
278-
php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
279-
RETURN_NULL(); \
280-
} \
276+
ZEND_ASSERT((__ptr)->mysql && "Missing connection?"); \
281277
}
282278

283279
#define MYSQLI_FETCH_RESOURCE_STMT(__ptr, __id, __check) \
284280
{ \
285281
MYSQLI_FETCH_RESOURCE((__ptr), MY_STMT *, (__id), "mysqli_stmt", (__check)); \
286-
if (!(__ptr)->stmt) { \
287-
mysqli_object *intern = Z_MYSQLI_P(__id); \
288-
php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
289-
RETURN_NULL();\
290-
} \
282+
ZEND_ASSERT((__ptr)->stmt && "Missing statement?"); \
291283
}
292284

293285
#define MYSQLI_SET_STATUS(__id, __value) \

0 commit comments

Comments
 (0)