Skip to content

Commit 4a7332f

Browse files
authored
Remove pointless operations from zend_user_serialize() (#18188)
We don't have to call zval_ptr_dtor() on IS_NULL, and we only have to check for the UNDEF type. Reduces code size from 231 to 199 on x86-64.
1 parent 0607c22 commit 4a7332f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Zend/zend_interfaces.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,12 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b
412412
zend_call_method_with_0_params(
413413
Z_OBJ_P(object), Z_OBJCE_P(object), NULL, "serialize", &retval);
414414

415-
if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) {
415+
if (Z_TYPE(retval) == IS_UNDEF) {
416416
result = FAILURE;
417417
} else {
418418
switch(Z_TYPE(retval)) {
419419
case IS_NULL:
420420
/* we could also make this '*buf_len = 0' but this allows to skip variables */
421-
zval_ptr_dtor(&retval);
422421
return FAILURE;
423422
case IS_STRING:
424423
*buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval));

0 commit comments

Comments
 (0)