Permalink
Browse files

Fix require()

  • Loading branch information...
1 parent c60c1b8 commit ad115d20888bc933f3b6e961638b567a6fae03ae @zsuraski zsuraski committed Jan 29, 2000
Showing with 11 additions and 11 deletions.
  1. +1 −1 Zend/zend-parser.y
  2. +6 −2 Zend/zend-scanner.l
  3. +4 −8 Zend/zend_compile.h
View
@@ -138,7 +138,7 @@
%% /* Rules */
start:
- top_statement_list { do_return(NULL, 0 CLS_CC); }
+ top_statement_list
;
top_statement_list:
View
@@ -355,7 +355,6 @@ ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count,
compiler_result = zendparse(CLS_C);
zend_close_file_handle(file_handle CLS_CC);
restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
if (compiler_result==1) { /* parser error */
CG(unclean_shutdown) = 1;
retval = NULL;
@@ -367,11 +366,14 @@ ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count,
if (retval) {
if (compiled_files>0) {
+ do_return(NULL, 0 CLS_CC);
+ CG(active_op_array) = original_active_op_array;
pass_two(op_array);
if (mark_as_ref) {
pass_include_eval(op_array);
}
} else {
+ CG(active_op_array) = original_active_op_array;
destroy_op_array(op_array);
efree(op_array);
retval = NULL;
@@ -478,12 +480,14 @@ zend_op_array *compile_string(zval *source_string CLS_DC)
#endif
compiler_result = zendparse(CLS_C);
restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
if (compiler_result==1) {
+ CG(active_op_array) = original_active_op_array;
CG(unclean_shutdown)=1;
retval = NULL;
} else {
+ do_return(NULL, 0 CLS_CC);
+ CG(active_op_array) = original_active_op_array;
pass_two(op_array);
pass_include_eval(op_array);
retval = op_array;
View
@@ -190,10 +190,11 @@ typedef struct _zend_file_handle {
#define EXT_TYPE_UNUSED (1<<0)
+BEGIN_EXTERN_C()
+
void init_compiler(CLS_D ELS_DC);
void shutdown_compiler(CLS_D);
-BEGIN_EXTERN_C()
extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...);
void zend_activate(CLS_D ELS_DC);
@@ -214,7 +215,6 @@ const char *zend_get_zendtext(CLS_D);
int zend_get_zendleng(CLS_D);
#endif
-END_EXTERN_C()
/* parser-driven code generators */
void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
@@ -354,7 +354,6 @@ void do_ticks(CLS_D);
/* helper functions in zend-scanner.l */
-BEGIN_EXTERN_C()
ZEND_API int require_file(zend_file_handle *file_handle, zend_bool unique CLS_DC);
ZEND_API int require_filename(char *filename CLS_DC);
ZEND_API int use_filename(char *filename, uint filename_length CLS_DC);
@@ -367,7 +366,6 @@ ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size);
ZEND_API void destroy_op_array(zend_op_array *op_array);
ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC);
ZEND_API void zend_open_file_dtor(zend_file_handle *fh);
-END_EXTERN_C()
ZEND_API void destroy_zend_function(zend_function *function);
ZEND_API void destroy_zend_class(zend_class_entry *ce);
@@ -381,16 +379,12 @@ void init_op(zend_op *op CLS_DC);
int get_next_op_number(zend_op_array *op_array);
int print_class(zend_class_entry *class_entry);
void print_op_array(zend_op_array *op_array, int optimizations);
-BEGIN_EXTERN_C()
int pass_two(zend_op_array *op_array);
void pass_include_eval(zend_op_array *op_array);
-END_EXTERN_C()
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
-
int zendlex(znode *zendlval CLS_DC);
-
#define ZEND_NOP 0
#define ZEND_ADD 1
@@ -629,4 +623,6 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_RETURN_VAL 0
#define ZEND_RETURN_REF 1
+END_EXTERN_C()
+
#endif /* _COMPILE_H */

0 comments on commit ad115d2

Please sign in to comment.