continue;
}
if (zend_string_equals_literal(var_name, "this")) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- return -1;
+ goto prefix;
}
- ZVAL_MAKE_REF(entry);
- Z_ADDREF_P(entry);
+ if (Z_ISREF_P(entry)) {
+ Z_ADDREF_P(entry);
+ } else {
+ ZVAL_MAKE_REF_EX(entry, 2);
+ }
zend_hash_add_new(symbol_table, var_name, entry);
count++;
}
continue;
}
if (zend_string_equals_literal(var_name, "this")) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- return -1;
+ goto prefix;
}
ZVAL_DEREF(entry);
- if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
+ Z_TRY_ADDREF_P(entry);
zend_hash_add_new(symbol_table, var_name, entry);
count++;
}
ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
if (var_name) {
- if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))
+ || zend_string_equals_literal(var_name, "this")) {
php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
- zend_string_release(Z_STR(final_name));
+ zval_ptr_dtor_str(&final_name);
continue;
}
} else {
ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) {
if (var_name) {
- if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))
+ || zend_string_equals_literal(var_name, "this")) {
php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
if (!php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) {
- zend_string_release(Z_STR(final_name));
+ zval_ptr_dtor_str(&final_name);
continue;
}
} else {
continue;
}
if (zend_string_equals_literal(var_name, "this")) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- return -1;
+ continue;
}
- orig_var = zend_hash_find(symbol_table, var_name);
+ orig_var = zend_hash_find_ex(symbol_table, var_name, 1);
if (orig_var) {
if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
orig_var = Z_INDIRECT_P(orig_var);
continue;
}
if (zend_string_equals_literal(var_name, "this")) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- return -1;
+ continue;
}
- orig_var = zend_hash_find(symbol_table, var_name);
+ orig_var = zend_hash_find_ex(symbol_table, var_name, 1);
if (orig_var) {
if (Z_TYPE_P(orig_var) == IS_INDIRECT) {
orig_var = Z_INDIRECT_P(orig_var);