- Calling abstract methods should be a error for consistency reason.

- So in reflection_api we use the reflection_exception again.
This commit is contained in:
Marcus Boerger 2003-08-30 23:51:42 +00:00
parent c803e4643d
commit f1c92fa4c5
7 changed files with 4 additions and 26 deletions

View file

@ -25,7 +25,6 @@
#include "zend_builtin_functions.h"
zend_class_entry *default_exception_ptr;
zend_class_entry *abstract_exception_ptr;
static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC)
{
@ -347,9 +346,6 @@ static void zend_register_default_exception(TSRMLS_D)
zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED);
INIT_CLASS_ENTRY(ce, "abstract_exception", NULL);
abstract_exception_ptr = zend_register_internal_class_ex(&ce, default_exception_ptr, NULL TSRMLS_CC);
}
ZEND_API zend_class_entry *zend_exception_get_default(void)
@ -357,11 +353,6 @@ ZEND_API zend_class_entry *zend_exception_get_default(void)
return default_exception_ptr;
}
ZEND_API zend_class_entry *zend_exception_get_abstract(void)
{
return abstract_exception_ptr;
}
ZEND_API void zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...)
{
zval *ex;

View file

@ -25,7 +25,6 @@
BEGIN_EXTERN_C()
ZEND_API zend_class_entry *zend_exception_get_default(void);
ZEND_API zend_class_entry *zend_exception_get_abstract(void);
ZEND_API void zend_register_default_classes(TSRMLS_D);
/* exception_ce NULL or zend_exception_get_default() or a derived class

View file

@ -25,7 +25,6 @@
#include "zend_builtin_functions.h"
zend_class_entry *default_exception_ptr;
zend_class_entry *abstract_exception_ptr;
static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC)
{
@ -347,9 +346,6 @@ static void zend_register_default_exception(TSRMLS_D)
zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED);
INIT_CLASS_ENTRY(ce, "abstract_exception", NULL);
abstract_exception_ptr = zend_register_internal_class_ex(&ce, default_exception_ptr, NULL TSRMLS_CC);
}
ZEND_API zend_class_entry *zend_exception_get_default(void)
@ -357,11 +353,6 @@ ZEND_API zend_class_entry *zend_exception_get_default(void)
return default_exception_ptr;
}
ZEND_API zend_class_entry *zend_exception_get_abstract(void)
{
return abstract_exception_ptr;
}
ZEND_API void zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...)
{
zval *ex;

View file

@ -25,7 +25,6 @@
BEGIN_EXTERN_C()
ZEND_API zend_class_entry *zend_exception_get_default(void);
ZEND_API zend_class_entry *zend_exception_get_abstract(void);
ZEND_API void zend_register_default_classes(TSRMLS_D);
/* exception_ce NULL or zend_exception_get_default() or a derived class

View file

@ -33,7 +33,6 @@
#include "zend_extensions.h"
#include "zend_fast_cache.h"
#include "zend_ini.h"
#include "zend_default_classes.h"
#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC)
#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC)
@ -2501,8 +2500,8 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
zend_bool should_change_scope;
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(zend_exception_get_abstract(), 0 TSRMLS_CC, "Abstract method %s::%s called", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
goto fcall_exception;
zend_error(E_ERROR, "Abstract method %s::%s called", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
NEXT_OPCODE(); /* Never reached */
}
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) EX(opline)->extended_value, NULL);
@ -2635,7 +2634,6 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
EG(function_state_ptr) = &EX(function_state);
zend_ptr_stack_clear_multiple(TSRMLS_C);
fcall_exception:
if (EG(exception)) {
if (return_value_used && EX_T(EX(opline)->result.u.var).var.ptr) {
zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);

View file

@ -973,7 +973,7 @@ ZEND_METHOD(reflection_method, invoke)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(zend_exception_get_abstract(), 0 TSRMLS_CC,
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke abstract method %s::%s",
mptr->common.scope->name, mptr->common.function_name);
} else {

View file

@ -973,7 +973,7 @@ ZEND_METHOD(reflection_method, invoke)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(zend_exception_get_abstract(), 0 TSRMLS_CC,
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke abstract method %s::%s",
mptr->common.scope->name, mptr->common.function_name);
} else {