summaryrefslogtreecommitdiff
path: root/Zend/zend_default_classes.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-30 11:40:37 +0000
committerMarcus Boerger <helly@php.net>2003-08-30 11:40:37 +0000
commitf7f49e4584ebed812fb37945c0b2d3f0ad4efbcc (patch)
tree6deb549831d0f2beeefb0f4e49dd396729cf9cfe /Zend/zend_default_classes.c
parentad31a021bc9e6b83243adabd6a0c5c52bcc6c9d8 (diff)
downloadphp-git-f7f49e4584ebed812fb37945c0b2d3f0ad4efbcc.tar.gz
- The compiler can't detect all abstract function calls so we need to check.
# In this case throwing a dedicated exception is better than the error we # show when the compiler can detect the abstract call because its run-time.
Diffstat (limited to 'Zend/zend_default_classes.c')
-rw-r--r--Zend/zend_default_classes.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c
index 5c51ca1420..737bc604e5 100644
--- a/Zend/zend_default_classes.c
+++ b/Zend/zend_default_classes.c
@@ -25,6 +25,7 @@
#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)
{
@@ -138,10 +139,10 @@ static zend_function_entry default_exception_functions[] = {
static void zend_register_default_exception(TSRMLS_D)
{
- zend_class_entry default_exception;
+ zend_class_entry ce;
- INIT_CLASS_ENTRY(default_exception, "exception", default_exception_functions);
- default_exception_ptr = zend_register_internal_class(&default_exception TSRMLS_CC);
+ INIT_CLASS_ENTRY(ce, "exception", default_exception_functions);
+ default_exception_ptr = zend_register_internal_class(&ce TSRMLS_CC);
default_exception_ptr->create_object = zend_default_exception_new;
zend_declare_property_string(default_exception_ptr, "message", sizeof("message")-1, "Unknown exception", ZEND_ACC_PROTECTED);
@@ -149,6 +150,9 @@ 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)
@@ -156,6 +160,11 @@ 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;