@@ -1266,13 +1266,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
1266
1266
call->prev_execute_data = execute_data;
1267
1267
EG(current_execute_data) = call;
1268
1268
1269
+ #if ZEND_DEBUG
1270
+ /* Type checks for internal functions are usually only performed by zpp.
1271
+ * In debug mode we additionally run arginfo checks to detect cases where
1272
+ * arginfo and zpp went out of sync. */
1273
+ zend_bool wrong_arg_types =
1274
+ (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) &&
1275
+ !zend_verify_internal_arg_types(fbc, call);
1276
+ #endif
1277
+
1269
1278
ret = 0 ? EX_VAR(opline->result.var) : &retval;
1270
1279
ZVAL_NULL(ret);
1271
1280
1272
1281
fbc->internal_function.handler(call, ret);
1273
1282
1274
1283
#if ZEND_DEBUG
1275
1284
if (!EG(exception) && call->func) {
1285
+ ZEND_ASSERT(!wrong_arg_types && "Arginfo / zpp type mismatch?");
1276
1286
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
1277
1287
zend_verify_internal_return_type(call->func, ret));
1278
1288
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1311,13 +1321,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
1311
1321
call->prev_execute_data = execute_data;
1312
1322
EG(current_execute_data) = call;
1313
1323
1324
+ #if ZEND_DEBUG
1325
+ /* Type checks for internal functions are usually only performed by zpp.
1326
+ * In debug mode we additionally run arginfo checks to detect cases where
1327
+ * arginfo and zpp went out of sync. */
1328
+ zend_bool wrong_arg_types =
1329
+ (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) &&
1330
+ !zend_verify_internal_arg_types(fbc, call);
1331
+ #endif
1332
+
1314
1333
ret = 1 ? EX_VAR(opline->result.var) : &retval;
1315
1334
ZVAL_NULL(ret);
1316
1335
1317
1336
fbc->internal_function.handler(call, ret);
1318
1337
1319
1338
#if ZEND_DEBUG
1320
1339
if (!EG(exception) && call->func) {
1340
+ ZEND_ASSERT(!wrong_arg_types && "Arginfo / zpp type mismatch?");
1321
1341
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
1322
1342
zend_verify_internal_return_type(call->func, ret));
1323
1343
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1425,7 +1445,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
1425
1445
call->prev_execute_data = execute_data;
1426
1446
EG(current_execute_data) = call;
1427
1447
1428
-
1429
1448
#if ZEND_DEBUG
1430
1449
/* Type checks for internal functions are usually only performed by zpp.
1431
1450
* In debug mode we additionally run arginfo checks to detect cases where
@@ -1504,7 +1523,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
1504
1523
call->prev_execute_data = execute_data;
1505
1524
EG(current_execute_data) = call;
1506
1525
1507
-
1508
1526
#if ZEND_DEBUG
1509
1527
/* Type checks for internal functions are usually only performed by zpp.
1510
1528
* In debug mode we additionally run arginfo checks to detect cases where
0 commit comments