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));
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);
zend_file_handle file_handle;
zval tmp;
zend_op_array *retval;
- int error_reporting=0;
if (filename->type != IS_STRING) {
tmp = *filename;
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);
}
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);
#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
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);
/* 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, ...);
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 {
#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;