switch (Z_LVAL(opline->op2.u.constant)) {
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
zend_file_handle file_handle;
+ char cwd[MAXPATHLEN];
+ cwd_state state;
- if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
+ cwd[0] = '\0';
+ } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ cwd[0] = '\0';
+ }
+
+ state.cwd_length = strlen(cwd);
+ state.cwd = zend_strndup(cwd, state.cwd_length);
+ if (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)) {
+ failure_retval=1;
+ } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
}
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
+ if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
}
}
- break;
+ free(state.cwd);
}
break;
case ZEND_INCLUDE:
unsigned int function_name_strlen;
zend_bool is_const = (IS_CONST == IS_CONST);
+
if (is_const) {
function_name_strval = Z_UNIVAL(opline->op2.u.constant);
function_name_strlen = Z_UNILEN(opline->op2.u.constant);
zend_op *opline = EX(opline);
zval *class_name;
+
+
if (IS_CV == IS_UNUSED) {
EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
ZEND_VM_NEXT_OPCODE();
switch (Z_LVAL(opline->op2.u.constant)) {
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
zend_file_handle file_handle;
+ char cwd[MAXPATHLEN];
+ cwd_state state;
+
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
+ cwd[0] = '\0';
+ } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ cwd[0] = '\0';
+ }
- if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
+ state.cwd_length = strlen(cwd);
+ state.cwd = zend_strndup(cwd, state.cwd_length);
+ if (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)) {
+ failure_retval=1;
+ } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
}
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
+ if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
}
}
- break;
+ free(state.cwd);
}
break;
case ZEND_INCLUDE:
}
}
}
- ex = ex->prev_execute_data;
- } while (ex && ex->symbol_table == target_symbol_table);
+ ex = ex->prev_execute_data;
+ } while (ex && ex->symbol_table == target_symbol_table);
}
}
switch (Z_LVAL(opline->op2.u.constant)) {
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
zend_file_handle file_handle;
+ char cwd[MAXPATHLEN];
+ cwd_state state;
+
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
+ cwd[0] = '\0';
+ } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ cwd[0] = '\0';
+ }
- if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
+ state.cwd_length = strlen(cwd);
+ state.cwd = zend_strndup(cwd, state.cwd_length);
+ if (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)) {
+ failure_retval=1;
+ } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
}
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
+ if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
}
}
- break;
+ free(state.cwd);
}
break;
case ZEND_INCLUDE:
}
}
}
- ex = ex->prev_execute_data;
- } while (ex && ex->symbol_table == target_symbol_table);
+ ex = ex->prev_execute_data;
+ } while (ex && ex->symbol_table == target_symbol_table);
}
}
switch (Z_LVAL(opline->op2.u.constant)) {
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
zend_file_handle file_handle;
+ char cwd[MAXPATHLEN];
+ cwd_state state;
+
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
+ cwd[0] = '\0';
+ } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ cwd[0] = '\0';
+ }
- if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
+ state.cwd_length = strlen(cwd);
+ state.cwd = zend_strndup(cwd, state.cwd_length);
+ if (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)) {
+ failure_retval=1;
+ } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
}
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
+ if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
}
}
- break;
+ free(state.cwd);
}
break;
case ZEND_INCLUDE:
}
}
}
- ex = ex->prev_execute_data;
- } while (ex && ex->symbol_table == target_symbol_table);
+ ex = ex->prev_execute_data;
+ } while (ex && ex->symbol_table == target_symbol_table);
}
}
switch (Z_LVAL(opline->op2.u.constant)) {
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
- int dummy = 1;
zend_file_handle file_handle;
+ char cwd[MAXPATHLEN];
+ cwd_state state;
- if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
+ cwd[0] = '\0';
+ } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
+ cwd[0] = '\0';
+ }
+
+ state.cwd_length = strlen(cwd);
+ state.cwd = zend_strndup(cwd, state.cwd_length);
+ if (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1)) {
+ failure_retval=1;
+ } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
if (!file_handle.opened_path) {
file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
}
- if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) {
+ if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
}
}
- break;
+ free(state.cwd);
}
break;
case ZEND_INCLUDE:
}
}
}
- ex = ex->prev_execute_data;
- } while (ex && ex->symbol_table == target_symbol_table);
+ ex = ex->prev_execute_data;
+ } while (ex && ex->symbol_table == target_symbol_table);
}
}