Zend/zend_exceptions: Add const modifiers

This commit is contained in:
Gina Peter Banyard 2025-07-04 11:29:11 +01:00
parent abee5c138f
commit c9e91bfbab
2 changed files with 5 additions and 5 deletions

View file

@ -67,7 +67,7 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr
{ {
/* zend_ce_exception and zend_ce_error may not be initialized yet when this is called (e.g when /* zend_ce_exception and zend_ce_error may not be initialized yet when this is called (e.g when
* implementing Throwable for Exception itself). Perform a manual inheritance check. */ * implementing Throwable for Exception itself). Perform a manual inheritance check. */
zend_class_entry *root = class_type; const zend_class_entry *root = class_type;
while (root->parent) { while (root->parent) {
root = root->parent; root = root->parent;
} }
@ -89,13 +89,13 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr
} }
/* }}} */ /* }}} */
static inline zend_class_entry *i_get_exception_base(zend_object *object) /* {{{ */ static inline zend_class_entry *i_get_exception_base(const zend_object *object) /* {{{ */
{ {
return instanceof_function(object->ce, zend_ce_exception) ? zend_ce_exception : zend_ce_error; return instanceof_function(object->ce, zend_ce_exception) ? zend_ce_exception : zend_ce_error;
} }
/* }}} */ /* }}} */
ZEND_API zend_class_entry *zend_get_exception_base(zend_object *object) /* {{{ */ ZEND_API zend_class_entry *zend_get_exception_base(const zend_object *object) /* {{{ */
{ {
return i_get_exception_base(object); return i_get_exception_base(object);
} }
@ -192,7 +192,7 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception) /*
#endif /* HAVE_DTRACE */ #endif /* HAVE_DTRACE */
if (exception != NULL) { if (exception != NULL) {
zend_object *previous = EG(exception); const zend_object *previous = EG(exception);
if (previous && zend_is_unwind_exit(previous)) { if (previous && zend_is_unwind_exit(previous)) {
/* Don't replace unwinding exception with different exception. */ /* Don't replace unwinding exception with different exception. */
OBJ_RELEASE(exception); OBJ_RELEASE(exception);

View file

@ -48,7 +48,7 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zend_object *exception);
void zend_register_default_exception(void); void zend_register_default_exception(void);
ZEND_API zend_class_entry *zend_get_exception_base(zend_object *object); ZEND_API zend_class_entry *zend_get_exception_base(const zend_object *object);
ZEND_API void zend_register_default_classes(void); ZEND_API void zend_register_default_classes(void);