1
0
mirror of https://github.com/php/php-src.git synced 2026-04-09 00:53:30 +02:00

Merge branch 'refactoring2' of github.com:zendtech/php into refactoring2

Conflicts:
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner.l
This commit is contained in:
Xinchen Hui
2014-02-21 22:41:48 +08:00
8 changed files with 287 additions and 269 deletions

View File

@@ -225,6 +225,9 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
{
if (Z_TYPE_P(arg) == IS_REFERENCE) {
arg = Z_REFVAL_P(arg);
}
return zend_get_type_by_const(Z_TYPE_P(arg));
}
/* }}} */
@@ -703,8 +706,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
break;
//???
//??? 'Z' iz not supported anymore and should be replaced with 'z'
case 'Z':
ZEND_ASSERT(c != 'Z');
default:
return "unknown";
}
@@ -2600,7 +2604,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
lcname = STR_ALLOC(name_len, 1);
zend_str_tolower_copy(lcname->val, name, name_len);
}
ce = zend_hash_add_ptr(CG(class_table), lcname, &ce);
ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
STR_RELEASE(lcname);
if (ce) {
ce->refcount++;

View File

@@ -2237,7 +2237,7 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
/* This is a compound class name that contains namespace prefix */
if (Z_STRVAL(class_name->u.constant)[0] == '\\') {
/* The STRING name has "\" prefix */
memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)-1);
memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant));
Z_STR(class_name->u.constant) = STR_REALLOC(
Z_STR(class_name->u.constant),
Z_STRLEN(class_name->u.constant) - 1, 0);
@@ -2611,7 +2611,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
zend_error_noreturn(E_COMPILE_ERROR,
"Call-time pass-by-reference has been removed; "
"If you would like to pass argument by reference, modify the declaration of %s().",
function_ptr->common.function_name);
function_ptr->common.function_name->val);
} else {
zend_error_noreturn(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed");
}
@@ -3516,13 +3516,13 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
&& parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
&& child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",
parent->common.scope->name,
child->common.function_name,
child->common.prototype ? child->common.prototype->common.scope->name : child->common.scope->name);
parent->common.scope->name->val,
child->common.function_name->val,
child->common.prototype ? child->common.prototype->common.scope->name->val : child->common.scope->name->val);
}
if (parent_flags & ZEND_ACC_FINAL) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name);
zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val);
}
child_flags = child->common.fn_flags;
@@ -3530,15 +3530,15 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
*/
if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) {
if (child->common.fn_flags & ZEND_ACC_STATIC) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
} else {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
}
}
/* Disallow making an inherited method abstract. */
if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
}
if (parent_flags & ZEND_ACC_CHANGED) {
@@ -3547,7 +3547,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
/* Prevent derived classes from restricting access that was available in parent classes
*/
if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) {
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
} else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK))
&& ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) {
child->common.fn_flags |= ZEND_ACC_CHANGED;
@@ -3566,7 +3566,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
}
} else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
@@ -3718,10 +3718,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
if ((ce->ce_flags & ZEND_ACC_INTERFACE)
&& !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name, parent_ce->name);
zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val);
}
if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name, parent_ce->name);
zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val);
}
ce->parent = parent_ce;
@@ -3875,7 +3875,7 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
if (i < parent_iface_num) {
ignore = 1;
} else {
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name, iface->name);
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name->val, iface->name->val);
}
}
}
@@ -4035,12 +4035,12 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
/* two traits can't define the same non-abstract method */
#if 1
zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s",
name, ce->name);
name, ce->name->val);
#else /* TODO: better error message */
zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s",
fn->common.scope->name, fn->common.function_name,
ce->name, name,
existing_fn->common.scope->name, existing_fn->common.function_name);
fn->common.scope->name->val, fn->common.function_name->val,
ce->name->val, name,
existing_fn->common.scope->name->val, existing_fn->common.function_name->val);
#endif
} else {
/* inherited members are overridden by members inserted by traits */
@@ -4172,7 +4172,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait
return;
}
}
zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name, ce->name);
zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name->val, ce->name->val);
}
/* }}} */
@@ -4267,7 +4267,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
STR_FREE(lcname);
if (!method_exists) {
zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name, cur_method_ref->method_name);
zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name->val, cur_method_ref->method_name);
}
}
i++;
@@ -4701,9 +4701,9 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array
}
if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name, parent_ce->name);
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name->val, parent_ce->name->val);
} else if ((parent_ce->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name, parent_ce->name);
zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name->val, parent_ce->name->val);
}
zend_do_inheritance(ce, parent_ce TSRMLS_CC);
@@ -5192,19 +5192,19 @@ void zend_do_end_class_declaration(const znode *class_token, const znode *parent
if (ce->constructor) {
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name, ce->constructor->common.function_name);
zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name->val, ce->constructor->common.function_name->val);
}
}
if (ce->destructor) {
ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name, ce->destructor->common.function_name);
zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name->val, ce->destructor->common.function_name->val);
}
}
if (ce->clone) {
ce->clone->common.fn_flags |= ZEND_ACC_CLONE;
if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) {
zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name, ce->clone->common.function_name);
zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name->val, ce->clone->common.function_name->val);
}
}
@@ -5255,7 +5255,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' since it is a Trait",
Z_STRVAL(interface_name->u.constant),
CG(active_class_entry)->name);
CG(active_class_entry)->name->val);
}
switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) {
@@ -5286,7 +5286,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use traits inside of interfaces. %s is used in %s",
Z_STRVAL(trait_name->u.constant), CG(active_class_entry)->name);
Z_STRVAL(trait_name->u.constant), CG(active_class_entry)->name->val);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1603,8 +1603,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"__FUNCTION__" {
zend_op_array *op_array = CG(active_op_array);
if (op_array && op_array->function_name) {
ZVAL_STR(zendlval, op_array->function_name);
Z_ADDREF_P(zendlval);
ZVAL_STR(zendlval, STR_COPY(op_array->function_name));
} else {
ZVAL_EMPTY_STRING(zendlval);
}
@@ -1612,25 +1611,33 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__METHOD__" {
const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name->val : NULL;
const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name->val : NULL;
//???
// Z_STRLEN_P(zendlval) = zend_spprintf((char**)&Z_STRVAL_P(zendlval), 0, "%s%s%s",
// class_name ? class_name : "",
// class_name && func_name ? "::" : "",
// func_name ? func_name : ""
// );
// zendlval->type = IS_STRING;
char *method_name;
int method_len;
if (CG(active_class_entry)) {
int len = 2;
method_len = zend_spprintf(&method_name, 0, "%s%s%s",
class_name ? class_name : "",
class_name && func_name ? "::" : "",
func_name ? func_name : ""
);
ZVAL_STRINGL(zendlval, method_name, method_len);
efree(method_name);
if (CG(active_class_entry)->name) {
len += CG(active_class_entry)->name->len;
}
if (CG(active_op_array) && CG(active_op_array)->function_name) {
len += CG(active_op_array)->function_name->len;
}
ZVAL_STR(zendlval, STR_ALLOC(len, 0));
len = 0;
if (CG(active_class_entry)->name) {
memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
len += CG(active_class_entry)->name->len;
}
memcpy(Z_STRVAL_P(zendlval) + len, "::", sizeof("::")-1);
len += sizeof("::")-1;
if (CG(active_op_array) && CG(active_op_array)->function_name) {
memcpy(Z_STRVAL_P(zendlval) + len, CG(active_op_array)->function_name->val, CG(active_op_array)->function_name->len);
len += CG(active_op_array)->function_name->len;
}
Z_STRVAL_P(zendlval)[len] = 0;
} else if (CG(active_op_array) && CG(active_op_array)->function_name) {
ZVAL_STR(zendlval, STR_COPY(CG(active_op_array)->function_name));
} else {
ZVAL_EMPTY_STRING(zendlval);
}
return T_METHOD_C;
}

View File

@@ -3794,7 +3794,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -3807,13 +3807,13 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
file_handle.opened_path = estrdup(resolved_path);
}
//??? 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, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
//??? } else {
//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
//??? failure_retval=1;
//??? }
if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_file_handle_dtor(&file_handle TSRMLS_CC);
failure_retval=1;
}
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);

View File

@@ -2851,7 +2851,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -2864,13 +2864,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
file_handle.opened_path = estrdup(resolved_path);
}
//??? 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, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
//??? } else {
//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
//??? failure_retval=1;
//??? }
if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_file_handle_dtor(&file_handle TSRMLS_CC);
failure_retval=1;
}
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -7846,7 +7846,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -7859,13 +7859,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
//??? 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, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
//??? } else {
//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
//??? failure_retval=1;
//??? }
if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_file_handle_dtor(&file_handle TSRMLS_CC);
failure_retval=1;
}
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -12875,7 +12875,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -12888,13 +12888,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
//??? 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, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
//??? } else {
//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
//??? failure_retval=1;
//??? }
if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_file_handle_dtor(&file_handle TSRMLS_CC);
failure_retval=1;
}
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -29529,7 +29529,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -29542,13 +29542,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
file_handle.opened_path = estrdup(resolved_path);
}
//??? 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, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
//??? } else {
//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
//??? failure_retval=1;
//??? }
if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
zend_file_handle_dtor(&file_handle TSRMLS_CC);
failure_retval=1;
}
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);

View File

@@ -1861,7 +1861,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval *l
/* ..for each one, create a new zval, copy entry into it and copy it into the output hash */
for (i = 0; i < list_count; i++) {
entry = &list[i];
Z_ADDREF_P(entry);
if (IS_REFCOUNTED(Z_TYPE_P(entry))) Z_ADDREF_P(entry);
zend_hash_next_index_insert(out_hash, entry);
}
}
@@ -1871,7 +1871,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval *l
p = in_hash->arData + idx;
if (Z_TYPE(p->val) == IS_UNDEF) continue;
entry = &p->val;
Z_ADDREF_P(entry);
if (IS_REFCOUNTED(Z_TYPE_P(entry))) Z_ADDREF_P(entry);
if (p->key == NULL) {
zend_hash_next_index_insert(out_hash, entry);
} else {

View File

@@ -90,34 +90,34 @@ PHP_FUNCTION(gettype)
Set the type of the variable */
PHP_FUNCTION(settype)
{
zval **var;
zval *var;
char *type;
int type_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type, &type_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &var, &type, &type_len) == FAILURE) {
return;
}
if (!strcasecmp(type, "integer")) {
convert_to_long(*var);
convert_to_long(var);
} else if (!strcasecmp(type, "int")) {
convert_to_long(*var);
convert_to_long(var);
} else if (!strcasecmp(type, "float")) {
convert_to_double(*var);
convert_to_double(var);
} else if (!strcasecmp(type, "double")) { /* deprecated */
convert_to_double(*var);
convert_to_double(var);
} else if (!strcasecmp(type, "string")) {
convert_to_string(*var);
convert_to_string(var);
} else if (!strcasecmp(type, "array")) {
convert_to_array(*var);
convert_to_array(var);
} else if (!strcasecmp(type, "object")) {
convert_to_object(*var);
convert_to_object(var);
} else if (!strcasecmp(type, "bool")) {
convert_to_boolean(*var);
convert_to_boolean(var);
} else if (!strcasecmp(type, "boolean")) {
convert_to_boolean(*var);
convert_to_boolean(var);
} else if (!strcasecmp(type, "null")) {
convert_to_null(*var);
convert_to_null(var);
} else if (!strcasecmp(type, "resource")) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot convert to resource type");
RETURN_FALSE;