Skip to content

Commit 4282362

Browse files
committed
Move instanceof check inside ZEND_DEBUG guard
This makes sure we don't get a performance penalty in release mode because the release mode build will still perform the call as the compiler doesn't know instanceof is side-effect-free.
1 parent 0483798 commit 4282362

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/odbc/php_odbc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ static zend_object_handlers odbc_connection_object_handlers, odbc_result_object_
7878
#define Z_ODBC_RESULT_P(zv) odbc_result_from_obj(Z_OBJ_P(zv))
7979

8080
static void odbc_insert_new_result(odbc_connection *connection, zval *result) {
81-
ZEND_ASSERT(Z_TYPE_P(result) == IS_OBJECT && instanceof_function(Z_OBJCE_P(result), odbc_result_ce));
81+
ZEND_ASSERT(Z_TYPE_P(result) == IS_OBJECT);
82+
#if ZEND_DEBUG
83+
ZEND_ASSERT(instanceof_function(Z_OBJCE_P(result), odbc_result_ce));
84+
#endif
8285

8386
odbc_result *res = Z_ODBC_RESULT_P(result);
8487

0 commit comments

Comments
 (0)