Browse Source

Fix warning issue (compile errors inside require()'d files were incorrectly supressed)

PHP-4.0.5
Zeev Suraski 26 years ago
parent
commit
7795aca4ca
  1. 27
      Zend/zend-scanner.l
  2. 2
      Zend/zend.c
  3. 2
      Zend/zend_compile.c
  4. 4
      Zend/zend_compile.h
  5. 2
      Zend/zend_execute.c
  6. 2
      Zend/zend_extensions.h

27
Zend/zend-scanner.l

@ -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));
@ -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);
@ -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;
@ -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);
}

2
Zend/zend.c

@ -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);

2
Zend/zend_compile.c

@ -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

4
Zend/zend_compile.h

@ -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);
@ -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, ...);

2
Zend/zend_execute.c

@ -1986,7 +1986,7 @@ send_by_ref:
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 {

2
Zend/zend_extensions.h

@ -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;

Loading…
Cancel
Save