summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-05-06 19:30:31 +0000
committerZeev Suraski <zeev@php.net>2001-05-06 19:30:31 +0000
commitbda9c83a82db703c715ae77c8b86fb8c43248d20 (patch)
tree7dad6306c893853dd55943b8d00ded568cef5874 /Zend
parentf3342a5b55a69a145367d33d5295d650e12d9b98 (diff)
downloadphp-git-bda9c83a82db703c715ae77c8b86fb8c43248d20.tar.gz
Recover from a parse error in include files (before, it could result in a crash under certain circumstances). Fix bug #8663
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend_compile.c17
-rw-r--r--Zend/zend_compile.h1
3 files changed, 17 insertions, 5 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 77ed3ef141..61260dbe59 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -696,6 +696,10 @@ ZEND_API void zend_error(int type, const char *format, ...)
}
va_end(args);
+
+ if (type==E_PARSE) {
+ zend_init_compiler_data_structures(CLS_C);
+ }
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index c3a74bc12a..67947a02fb 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -57,14 +57,15 @@ static void build_runtime_defined_function_key(zval *result, zval *name, zend_op
}
-static void init_compiler_declarables(CLS_D ELS_DC)
+static void init_compiler_declarables(CLS_D)
{
CG(declarables).ticks.type = IS_LONG;
CG(declarables).ticks.value.lval = 0;
}
-void init_compiler(CLS_D ELS_DC)
+
+void zend_init_compiler_data_structures(CLS_D)
{
zend_stack_init(&CG(bp_stack));
zend_stack_init(&CG(function_call_stack));
@@ -75,13 +76,19 @@ void init_compiler(CLS_D ELS_DC)
CG(active_class_entry) = NULL;
zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0);
zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0);
- zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
CG(handle_op_arrays) = 1;
CG(in_compilation) = 0;
+ init_compiler_declarables(CLS_C);
+}
+
+
+void init_compiler(CLS_D ELS_DC)
+{
+ zend_init_compiler_data_structures(CLS_C);
zend_init_rsrc_list(ELS_C);
- CG(unclean_shutdown) = 0;
+ zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
- init_compiler_declarables(CLS_C ELS_CC);
+ CG(unclean_shutdown) = 0;
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 0328a4d49d..be986f12cc 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -208,6 +208,7 @@ BEGIN_EXTERN_C()
void init_compiler(CLS_D ELS_DC);
void shutdown_compiler(CLS_D);
+void zend_init_compiler_data_structures(CLS_D);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type CLS_DC);