Skip to content

Commit 20991b1

Browse files
committed
% remove CANCELLATION exception from PHPCore
1 parent f7b02c3 commit 20991b1

File tree

5 files changed

+6
-193
lines changed

5 files changed

+6
-193
lines changed

Zend/zend_async_API.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static zend_class_entry *get_class_ce(zend_async_class type)
115115
|| type == ZEND_ASYNC_EXCEPTION_INPUT_OUTPUT) {
116116
return zend_ce_exception;
117117
} else if (type == ZEND_ASYNC_EXCEPTION_CANCELLATION) {
118-
return zend_ce_cancellation_exception;
118+
return zend_ce_error;
119119
}
120120

121121
return NULL;
@@ -908,7 +908,9 @@ ZEND_API bool zend_async_waker_apply_error(zend_async_waker_t *waker, zend_objec
908908
return true;
909909
}
910910

911-
if (for_cancellation && instanceof_function(waker->error->ce, zend_ce_cancellation_exception)) {
911+
const zend_class_entry *ce_cancellation_exception = ZEND_ASYNC_GET_EXCEPTION_CE(ZEND_ASYNC_EXCEPTION_CANCELLATION);
912+
913+
if (for_cancellation && instanceof_function(waker->error->ce, ce_cancellation_exception)) {
912914
// If the waker already has a cancellation exception, we do not override it
913915
if (tranfer_error) {
914916
OBJ_RELEASE(error);

Zend/zend_cancellation_exception.stub.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

Zend/zend_cancellation_exception_arginfo.h

Lines changed: 0 additions & 102 deletions
This file was deleted.

Zend/zend_exceptions.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "zend_dtrace.h"
2929
#include "zend_smart_str.h"
3030
#include "zend_exceptions_arginfo.h"
31-
#include "zend_cancellation_exception_arginfo.h"
3231
#include "zend_observer.h"
3332

3433
#define ZEND_EXCEPTION_MESSAGE_OFF 0
@@ -43,7 +42,6 @@ ZEND_API zend_class_entry *zend_ce_throwable;
4342
ZEND_API zend_class_entry *zend_ce_exception;
4443
ZEND_API zend_class_entry *zend_ce_error_exception;
4544
ZEND_API zend_class_entry *zend_ce_error;
46-
ZEND_API zend_class_entry *zend_ce_cancellation_exception;
4745
ZEND_API zend_class_entry *zend_ce_compile_error;
4846
ZEND_API zend_class_entry *zend_ce_parse_error;
4947
ZEND_API zend_class_entry *zend_ce_type_error;
@@ -74,9 +72,7 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr
7472
root = root->parent;
7573
}
7674
if (zend_string_equals_literal(root->name, "Exception")
77-
|| zend_string_equals_literal(root->name, "Error")
78-
|| zend_string_equals_literal(root->name, "CancellationException")
79-
) {
75+
|| zend_string_equals_literal(root->name, "Error")) {
8076
return SUCCESS;
8177
}
8278

@@ -95,23 +91,7 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr
9591

9692
static inline zend_class_entry *i_get_exception_base(zend_object *object) /* {{{ */
9793
{
98-
zend_class_entry *instance_ce = object->ce;
99-
100-
do
101-
{
102-
if (instance_ce == zend_ce_exception) {
103-
return zend_ce_exception;
104-
} else if (instance_ce == zend_ce_error) {
105-
return zend_ce_error;
106-
} else if (instance_ce == zend_ce_cancellation_exception) {
107-
return zend_ce_cancellation_exception;
108-
}
109-
110-
instance_ce = instance_ce->parent;
111-
112-
} while (instance_ce != NULL);
113-
114-
return NULL;
94+
return instanceof_function(object->ce, zend_ce_exception) ? zend_ce_exception : zend_ce_error;
11595
}
11696
/* }}} */
11797

@@ -833,9 +813,6 @@ void zend_register_default_exception(void) /* {{{ */
833813
zend_ce_error = register_class_Error(zend_ce_throwable);
834814
zend_init_exception_class_entry(zend_ce_error);
835815

836-
zend_ce_cancellation_exception = register_class_CancellationException(zend_ce_throwable);
837-
zend_init_exception_class_entry(zend_ce_cancellation_exception);
838-
839816
zend_ce_compile_error = register_class_CompileError(zend_ce_error);
840817
zend_init_exception_class_entry(zend_ce_compile_error);
841818

Zend/zend_exceptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ extern ZEND_API zend_class_entry *zend_ce_throwable;
3030
extern ZEND_API zend_class_entry *zend_ce_exception;
3131
extern ZEND_API zend_class_entry *zend_ce_error_exception;
3232
extern ZEND_API zend_class_entry *zend_ce_error;
33-
extern ZEND_API zend_class_entry *zend_ce_cancellation_exception;
3433
extern ZEND_API zend_class_entry *zend_ce_compile_error;
3534
extern ZEND_API zend_class_entry *zend_ce_parse_error;
3635
extern ZEND_API zend_class_entry *zend_ce_type_error;

0 commit comments

Comments
 (0)