From: Aaron Piotrowski Date: Fri, 3 Jul 2015 01:57:53 +0000 (-0500) Subject: Cleanup exception ce API X-Git-Tag: php-7.1.0alpha3~25^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f9e9d3a43792846a483092bce409bc9927d24848;p=php Cleanup exception ce API Removed recently added functions to get Error ce's and marked the old functions fetching default_exception_ce and error_exception_ce as deprecated. --- diff --git a/Zend/zend.c b/Zend/zend.c index c4f620b9f2..1a74d316c0 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -882,7 +882,7 @@ void zenderror(const char *error) /* {{{ */ return; } - zend_throw_exception(zend_get_parse_error(), error, E_PARSE); + zend_throw_exception(zend_parse_error_ce, error, E_PARSE); } /* }}} */ @@ -1059,7 +1059,7 @@ static void zend_error_va_list(int type, const char *format, va_list args) va_start(args, format); #endif zend_vspprintf(&message, 0, format, args); - zend_throw_exception(zend_get_error(), message, type); + zend_throw_exception(zend_error_ce, message, type); efree(message); #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS) va_end(args); @@ -1318,7 +1318,7 @@ ZEND_API void zend_type_error(const char *format, ...) /* {{{ */ va_start(va, format); zend_vspprintf(&message, 0, format, va); - zend_throw_exception(zend_get_type_error(), message, E_ERROR); + zend_throw_exception(zend_type_error_ce, message, E_ERROR); efree(message); va_end(va); } /* }}} */ @@ -1331,7 +1331,7 @@ ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *fo va_start(va, format); zend_vspprintf(&message, 0, format, va); if (throw_exception) { - zend_throw_exception(zend_get_type_error(), message, E_ERROR); + zend_throw_exception(zend_type_error_ce, message, E_ERROR); } else { zend_error(E_WARNING, message); } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 8c44b31d8c..0f3ad2b06a 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -31,35 +31,36 @@ #include "zend_smart_str.h" ZEND_API zend_class_entry *zend_ce_throwable; +ZEND_API zend_class_entry *zend_exception_ce; +ZEND_API zend_class_entry *zend_error_exception_ce; +ZEND_API zend_class_entry *zend_error_ce; +ZEND_API zend_class_entry *zend_parse_error_ce; +ZEND_API zend_class_entry *zend_type_error_ce; ZEND_API zend_class_entry *zend_ce_arithmetic_error; ZEND_API zend_class_entry *zend_ce_division_by_zero_error; -static zend_class_entry *default_exception_ce; -static zend_class_entry *error_exception_ce; -static zend_class_entry *error_ce; -static zend_class_entry *parse_error_ce; -static zend_class_entry *type_error_ce; -static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex); +static zend_object_handlers default_exception_handlers; + /* {{{ zend_implement_throwable */ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { - if (instanceof_function(class_type, default_exception_ce) || instanceof_function(class_type, error_ce)) { + if (instanceof_function(class_type, zend_exception_ce) || instanceof_function(class_type, zend_error_ce)) { return SUCCESS; } zend_error_noreturn(E_ERROR, "Class %s cannot implement interface %s, extend %s or %s instead", ZSTR_VAL(class_type->name), ZSTR_VAL(interface->name), - ZSTR_VAL(default_exception_ce->name), - ZSTR_VAL(error_ce->name)); + ZSTR_VAL(zend_exception_ce->name), + ZSTR_VAL(zend_error_ce->name)); return FAILURE; } /* }}} */ static inline zend_class_entry *i_get_exception_base(zval *object) { - return instanceof_function(Z_OBJCE_P(object), default_exception_ce) ? default_exception_ce : error_ce; + return instanceof_function(Z_OBJCE_P(object), zend_exception_ce) ? zend_exception_ce : zend_error_ce; } ZEND_API zend_class_entry *zend_get_exception_base(zval *object) @@ -140,7 +141,7 @@ ZEND_API void zend_throw_exception_internal(zval *exception) /* {{{ */ } } if (!EG(current_execute_data)) { - if (exception && Z_OBJCE_P(exception) == parse_error_ce) { + if (exception && Z_OBJCE_P(exception) == zend_parse_error_ce) { return; } if(EG(exception)) { @@ -205,7 +206,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, base_ce = i_get_exception_base(&obj); - if (EXPECTED(class_type != parse_error_ce || !(filename = zend_get_compiled_filename()))) { + if (EXPECTED(class_type != zend_parse_error_ce || !(filename = zend_get_compiled_filename()))) { zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename()); zend_update_property_long(base_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno()); } else { @@ -294,7 +295,7 @@ ZEND_METHOD(error_exception, __construct) if (execute_data->called_scope) { ce = execute_data->called_scope; } else { - ce = error_exception_ce; + ce = zend_error_exception_ce; } zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name)); return; @@ -303,25 +304,25 @@ ZEND_METHOD(error_exception, __construct) object = getThis(); if (message) { - zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message); + zend_update_property_string(zend_exception_ce, object, "message", sizeof("message")-1, message); } if (code) { - zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code); + zend_update_property_long(zend_exception_ce, object, "code", sizeof("code")-1, code); } if (previous) { - zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous); + zend_update_property(zend_exception_ce, object, "previous", sizeof("previous")-1, previous); } - zend_update_property_long(error_exception_ce, object, "severity", sizeof("severity")-1, severity); + zend_update_property_long(zend_error_exception_ce, object, "severity", sizeof("severity")-1, severity); if (argc >= 4) { - zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename); + zend_update_property_string(zend_exception_ce, object, "file", sizeof("file")-1, filename); if (argc < 5) { lineno = 0; /* invalidate lineno */ } - zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno); + zend_update_property_long(zend_exception_ce, object, "line", sizeof("line")-1, lineno); } } /* }}} */ @@ -708,7 +709,7 @@ ZEND_METHOD(exception, __toString) ZVAL_UNDEF(&trace); } - if (Z_OBJCE_P(exception) == type_error_ce && strstr(ZSTR_VAL(message), ", called in ")) { + if (Z_OBJCE_P(exception) == zend_type_error_ce && strstr(ZSTR_VAL(message), ", called in ")) { zend_string *real_message = zend_strpprintf(0, "%s and defined", ZSTR_VAL(message)); zend_string_release(message); message = real_message; @@ -818,46 +819,46 @@ void zend_register_default_exception(void) /* {{{ */ default_exception_handlers.clone_obj = NULL; INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions); - default_exception_ce = zend_register_internal_class_ex(&ce, NULL); - default_exception_ce->create_object = zend_default_exception_new; - zend_class_implements(default_exception_ce, 1, zend_ce_throwable); - - zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED); - zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE); - zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED); - zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED); - zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); - zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); + zend_exception_ce = zend_register_internal_class_ex(&ce, NULL); + zend_exception_ce->create_object = zend_default_exception_new; + zend_class_implements(zend_exception_ce, 1, zend_ce_throwable); + + zend_declare_property_string(zend_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED); + zend_declare_property_string(zend_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE); + zend_declare_property_long(zend_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); + zend_declare_property_null(zend_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions); - error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce); - error_exception_ce->create_object = zend_error_exception_new; - zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED); + zend_error_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_ce); + zend_error_exception_ce->create_object = zend_error_exception_new; + zend_declare_property_long(zend_error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED); INIT_CLASS_ENTRY(ce, "Error", default_exception_functions); - error_ce = zend_register_internal_class_ex(&ce, NULL); - error_ce->create_object = zend_default_exception_new; - zend_class_implements(error_ce, 1, zend_ce_throwable); - - zend_declare_property_string(error_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED); - zend_declare_property_string(error_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE); - zend_declare_property_long(error_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(error_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED); - zend_declare_property_null(error_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED); - zend_declare_property_null(error_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); - zend_declare_property_null(error_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); + zend_error_ce = zend_register_internal_class_ex(&ce, NULL); + zend_error_ce->create_object = zend_default_exception_new; + zend_class_implements(zend_error_ce, 1, zend_ce_throwable); + + zend_declare_property_string(zend_error_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED); + zend_declare_property_string(zend_error_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE); + zend_declare_property_long(zend_error_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_error_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_error_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED); + zend_declare_property_null(zend_error_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); + zend_declare_property_null(zend_error_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); INIT_CLASS_ENTRY(ce, "ParseError", NULL); - parse_error_ce = zend_register_internal_class_ex(&ce, error_ce); - parse_error_ce->create_object = zend_default_exception_new; + zend_parse_error_ce = zend_register_internal_class_ex(&ce, zend_error_ce); + zend_parse_error_ce->create_object = zend_default_exception_new; INIT_CLASS_ENTRY(ce, "TypeError", NULL); - type_error_ce = zend_register_internal_class_ex(&ce, error_ce); - type_error_ce->create_object = zend_default_exception_new; + zend_type_error_ce = zend_register_internal_class_ex(&ce, zend_error_ce); + zend_type_error_ce->create_object = zend_default_exception_new; INIT_CLASS_ENTRY(ce, "ArithmeticError", NULL); - zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, error_ce); + zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, zend_error_ce); zend_ce_arithmetic_error->create_object = zend_default_exception_new; INIT_CLASS_ENTRY(ce, "DivisionByZeroError", NULL); @@ -866,37 +867,20 @@ void zend_register_default_exception(void) /* {{{ */ } /* }}} */ -ZEND_API zend_class_entry *zend_exception_get_default(void) /* {{{ */ -{ - return default_exception_ce; -} -/* }}} */ - -ZEND_API zend_class_entry *zend_get_error_exception(void) /* {{{ */ -{ - return error_exception_ce; -} -/* }}} */ - -ZEND_API zend_class_entry *zend_get_error(void) /* {{{ */ -{ - return error_ce; -} -/* }}} */ - -ZEND_API zend_class_entry *zend_get_parse_error(void) /* {{{ */ +/* {{{ Deprecated - Use zend_exception_ce directly instead */ +ZEND_API zend_class_entry *zend_exception_get_default(void) { - return parse_error_ce; + return zend_exception_ce; } /* }}} */ -ZEND_API zend_class_entry *zend_get_type_error(void) /* {{{ */ +/* {{{ Deprecated - Use zend_error_exception_ce directly instead */ +ZEND_API zend_class_entry *zend_get_error_exception(void) { - return type_error_ce; + return zend_error_exception_ce; } /* }}} */ - ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */ { zval ex; @@ -904,10 +888,10 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const if (exception_ce) { if (!instanceof_function(exception_ce, zend_ce_throwable)) { zend_error(E_NOTICE, "Exceptions must implement Throwable"); - exception_ce = default_exception_ce; + exception_ce = zend_exception_ce; } } else { - exception_ce = default_exception_ce; + exception_ce = zend_exception_ce; } object_init_ex(&ex, exception_ce); @@ -944,7 +928,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, zval ex; zend_object *obj = zend_throw_exception(exception_ce, message, code); ZVAL_OBJ(&ex, obj); - zend_update_property_long(error_exception_ce, &ex, "severity", sizeof("severity")-1, severity); + zend_update_property_long(zend_error_exception_ce, &ex, "severity", sizeof("severity")-1, severity); return obj; } /* }}} */ @@ -977,7 +961,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ ZVAL_OBJ(&exception, ex); ce_exception = Z_OBJCE(exception); EG(exception) = NULL; - if (ce_exception == parse_error_ce) { + if (ce_exception == zend_parse_error_ce) { zend_string *message = zval_get_string(GET_PROPERTY(&exception, "message")); zend_string *file = zval_get_string(GET_PROPERTY_SILENT(&exception, "file")); zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line")); @@ -1007,7 +991,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ ZVAL_OBJ(&zv, EG(exception)); /* do the best we can to inform about the inner exception */ - if (instanceof_function(ce_exception, default_exception_ce) || instanceof_function(ce_exception, error_ce)) { + if (instanceof_function(ce_exception, zend_exception_ce) || instanceof_function(ce_exception, zend_error_ce)) { file = zval_get_string(GET_PROPERTY_SILENT(&zv, "file")); line = zval_get_long(GET_PROPERTY_SILENT(&zv, "line")); } diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 8b5deed15c..268109af61 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -27,6 +27,11 @@ BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_throwable; +extern ZEND_API zend_class_entry *zend_exception_ce; +extern ZEND_API zend_class_entry *zend_error_exception_ce; +extern ZEND_API zend_class_entry *zend_error_ce; +extern ZEND_API zend_class_entry *zend_parse_error_ce; +extern ZEND_API zend_class_entry *zend_type_error_ce; extern ZEND_API zend_class_entry *zend_ce_arithmetic_error; extern ZEND_API zend_class_entry *zend_ce_division_by_zero_error; @@ -39,14 +44,16 @@ ZEND_API void zend_throw_exception_internal(zval *exception); void zend_register_default_exception(void); ZEND_API zend_class_entry *zend_get_exception_base(zval *object); + +/* Deprecated - Use zend_exception_ce directly instead */ ZEND_API zend_class_entry *zend_exception_get_default(void); + +/* Deprecated - Use zend_error_exception_ce directly instead */ ZEND_API zend_class_entry *zend_get_error_exception(void); -ZEND_API zend_class_entry *zend_get_error(void); -ZEND_API zend_class_entry *zend_get_parse_error(void); -ZEND_API zend_class_entry *zend_get_type_error(void); + ZEND_API void zend_register_default_classes(void); -/* exception_ce NULL or zend_exception_get_default() or a derived class +/* exception_ce NULL, zend_exception_ce, zend_error_ce, or a derived class * message NULL or the message of the exception */ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code); ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...); diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 6813cf4db2..63cab792b3 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1010,7 +1010,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot } if (!valid) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid UTF-8 codepoint escape sequence", E_PARSE); zval_ptr_dtor(zendlval); return FAILURE; @@ -1021,7 +1021,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot /* per RFC 3629, UTF-8 can only represent 21 bits */ if (codepoint > 0x10FFFF || errno) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid UTF-8 codepoint escape sequence: Codepoint too large", E_PARSE); zval_ptr_dtor(zendlval); return FAILURE; @@ -2743,7 +2743,7 @@ yy136: * Because the lexing itself doesn't do that for us */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), "Invalid numeric literal", E_PARSE); + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } } else { @@ -2759,7 +2759,7 @@ yy136: } /* Also not an assert for the same reason */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } @@ -2768,7 +2768,7 @@ yy136: } /* Also not an assert for the same reason */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), "Invalid numeric literal", E_PARSE); + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 01c489cbe4..ca2b202dd7 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1008,7 +1008,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot } if (!valid) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid UTF-8 codepoint escape sequence", E_PARSE); zval_ptr_dtor(zendlval); return FAILURE; @@ -1019,7 +1019,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot /* per RFC 3629, UTF-8 can only represent 21 bits */ if (codepoint > 0x10FFFF || errno) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid UTF-8 codepoint escape sequence: Codepoint too large", E_PARSE); zval_ptr_dtor(zendlval); return FAILURE; @@ -1658,7 +1658,7 @@ NEWLINE ("\r"|"\n"|"\r\n") * Because the lexing itself doesn't do that for us */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), "Invalid numeric literal", E_PARSE); + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } } else { @@ -1674,7 +1674,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } /* Also not an assert for the same reason */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } @@ -1683,7 +1683,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } /* Also not an assert for the same reason */ if (end != yytext + yyleng) { - zend_throw_exception(zend_get_parse_error(), "Invalid numeric literal", E_PARSE); + zend_throw_exception(zend_parse_error_ce, "Invalid numeric literal", E_PARSE); RETURN_TOKEN(T_ERROR); } } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index ca3b79bd97..7fc9ed67bb 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1495,10 +1495,10 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi ZVAL_OBJ(&exception_object, EG(exception)); if (instanceof_function(Z_OBJCE(exception_object), soap_fault_class_entry)) { soap_server_fault_ex(function, &exception_object, NULL); - } else if (instanceof_function(Z_OBJCE(exception_object), zend_get_error())) { + } else if (instanceof_function(Z_OBJCE(exception_object), zend_error_ce)) { if (service->send_errors) { zval rv; - zend_string *msg = zval_get_string(zend_read_property(zend_get_error(), &exception_object, "message", sizeof("message")-1, 0, &rv)); + zend_string *msg = zval_get_string(zend_read_property(zend_error_ce, &exception_object, "message", sizeof("message")-1, 0, &rv)); add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL); zend_string_release(msg); } else { @@ -2582,13 +2582,13 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL); ret = FALSE; } else if (Z_TYPE_P(response) != IS_STRING) { - if (EG(exception) && instanceof_function(EG(exception)->ce, zend_get_error())) { + if (EG(exception) && instanceof_function(EG(exception)->ce, zend_error_ce)) { zval rv; zend_string *msg; zval exception_object; ZVAL_OBJ(&exception_object, EG(exception)); - msg = zval_get_string(zend_read_property(zend_get_error(), &exception_object, "message", sizeof("message")-1, 0, &rv)); + msg = zval_get_string(zend_read_property(zend_error_ce, &exception_object, "message", sizeof("message")-1, 0, &rv)); /* change class */ EG(exception)->ce = soap_fault_class_entry; set_soap_fault(&exception_object, NULL, "Client", ZSTR_VAL(msg), NULL, NULL, NULL); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 6a4d7f27aa..95437f578b 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -114,7 +114,7 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "AssertionError", NULL); - assertion_error_ce = zend_register_internal_class_ex(&ce, zend_get_error()); + assertion_error_ce = zend_register_internal_class_ex(&ce, zend_error_ce); return SUCCESS; }