Skip to content

Commit

Permalink
Fix warning issue (compile errors inside require()'d files were incor…
Browse files Browse the repository at this point in the history
…rectly supressed)
  • Loading branch information
zsuraski committed Aug 15, 2000
1 parent 28273df commit 7795aca
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 25 deletions.
27 changes: 8 additions & 19 deletions Zend/zend-scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle CLS_DC)
END_EXTERN_C()


ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle CLS_DC)
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type CLS_DC)
{
zend_lex_state original_lex_state;
zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
Expand All @@ -347,7 +347,12 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle CLS_DC)
retval = op_array; /* success oriented */

if (open_file_for_scanning(file_handle CLS_CC)==FAILURE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
}
compilation_successful=0;
} else {
init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE CLS_CC);
Expand Down Expand Up @@ -382,7 +387,6 @@ zend_op_array *compile_filename(int type, zval *filename CLS_DC ELS_DC)
zend_file_handle file_handle;
zval tmp;
zend_op_array *retval;
int error_reporting=0;

if (filename->type != IS_STRING) {
tmp = *filename;
Expand All @@ -396,24 +400,9 @@ zend_op_array *compile_filename(int type, zval *filename CLS_DC ELS_DC)
file_handle.opened_path = NULL;


if (type==ZEND_REQUIRE) {
/* We don't want to hear about inclusion failures; If we fail,
* we'll generate a require failure
*/
error_reporting = EG(error_reporting);
EG(error_reporting) = 0;
}
retval = zend_compile_file(&file_handle CLS_CC);
retval = zend_compile_file(&file_handle, type CLS_CC);
zend_destroy_file_handle(&file_handle CLS_CC);

if (type==ZEND_REQUIRE) {
EG(error_reporting) = error_reporting;
if (!retval) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, filename->value.str.val);
zend_bailout();
}
}

if (filename==&tmp) {
zval_dtor(&tmp);
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...)
if (!file_handle) {
continue;
}
EG(active_op_array) = zend_compile_file(file_handle CLS_CC);
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE CLS_CC);
zend_destroy_file_handle(file_handle CLS_CC);
if (EG(active_op_array)) {
zend_execute(EG(active_op_array) ELS_CC);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "zend_fast_cache.h"


ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle CLS_DC);
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type CLS_DC);


#ifndef ZTS
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ BEGIN_EXTERN_C()
void init_compiler(CLS_D ELS_DC);
void shutdown_compiler(CLS_D);

extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle CLS_DC);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type CLS_DC);

void zend_activate(CLS_D ELS_DC);
void zend_deactivate(CLS_D ELS_DC);
Expand Down Expand Up @@ -375,7 +375,7 @@ ZEND_API void function_add_ref(zend_function *function);


/* helper functions in zend-scanner.l */
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle CLS_DC);
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type CLS_DC);
ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC);
ZEND_API zend_op_array *compile_filename(int type, zval *filename CLS_DC ELS_DC);
ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,7 @@ binary_assign_op_addr: {

if (file_handle.handle.fp) {
if (!opened_path || zend_hash_add(&EG(included_files), opened_path, strlen(opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle CLS_CC);
new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) CLS_CC);
zend_destroy_file_handle(&file_handle CLS_CC);
opened_path = NULL; /* zend_destroy_file_handle() already frees it */
} else {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "zend_compile.h"

#define ZEND_EXTENSION_API_NO 20000809
#define ZEND_EXTENSION_API_NO 20000815

typedef struct _zend_extension_version_info {
int zend_extension_api_no;
Expand Down

0 comments on commit 7795aca

Please sign in to comment.