Skip to content

Commit ed90588

Browse files
committed
Call handler directly if it's defined
1 parent 4e0c639 commit ed90588

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

Zend/zend_vm_def.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8460,12 +8460,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
84608460
zend_object *zobj = Z_OBJ_P(op1);
84618461
/* First, check if the handler is defined as it is faster */
84628462
if (zobj->handlers->count_elements) {
8463-
if (FAILURE == zobj->handlers->count_elements(zobj, &count)) {
8464-
zend_type_error("Parameter must be an array or an object that implements Countable");
8465-
}
8466-
if (UNEXPECTED(EG(exception))) {
8467-
count = 0;
8468-
}
8463+
zobj->handlers->count_elements(zobj, &count);
84698464
/* Otherwise check if the object implements Countable and call its count() method */
84708465
} else if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
84718466
zval retval;

Zend/zend_vm_execute.h

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9277,12 +9277,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
92779277
zend_object *zobj = Z_OBJ_P(op1);
92789278
/* First, check if the handler is defined as it is faster */
92799279
if (zobj->handlers->count_elements) {
9280-
if (FAILURE == zobj->handlers->count_elements(zobj, &count)) {
9281-
zend_type_error("Parameter must be an array or an object that implements Countable");
9282-
}
9283-
if (UNEXPECTED(EG(exception))) {
9284-
count = 0;
9285-
}
9280+
zobj->handlers->count_elements(zobj, &count);
92869281
/* Otherwise check if the object implements Countable and call its count() method */
92879282
} else if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
92889283
zval retval;
@@ -16349,12 +16344,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
1634916344
zend_object *zobj = Z_OBJ_P(op1);
1635016345
/* First, check if the handler is defined as it is faster */
1635116346
if (zobj->handlers->count_elements) {
16352-
if (FAILURE == zobj->handlers->count_elements(zobj, &count)) {
16353-
zend_type_error("Parameter must be an array or an object that implements Countable");
16354-
}
16355-
if (UNEXPECTED(EG(exception))) {
16356-
count = 0;
16357-
}
16347+
zobj->handlers->count_elements(zobj, &count);
1635816348
/* Otherwise check if the object implements Countable and call its count() method */
1635916349
} else if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
1636016350
zval retval;
@@ -45189,12 +45179,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
4518945179
zend_object *zobj = Z_OBJ_P(op1);
4519045180
/* First, check if the handler is defined as it is faster */
4519145181
if (zobj->handlers->count_elements) {
45192-
if (FAILURE == zobj->handlers->count_elements(zobj, &count)) {
45193-
zend_type_error("Parameter must be an array or an object that implements Countable");
45194-
}
45195-
if (UNEXPECTED(EG(exception))) {
45196-
count = 0;
45197-
}
45182+
zobj->handlers->count_elements(zobj, &count);
4519845183
/* Otherwise check if the object implements Countable and call its count() method */
4519945184
} else if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
4520045185
zval retval;

0 commit comments

Comments
 (0)