Skip to content

Instantly share code, notes, and snippets.

@laruence
Last active April 16, 2018 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/365045cf6ec50e2b73d4818ff384dc7e to your computer and use it in GitHub Desktop.
Save laruence/365045cf6ec50e2b73d4818ff384dc7e to your computer and use it in GitHub Desktop.
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 9244579..9269fe8 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2301,14 +2301,20 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
return FAILURE;
}
}
- lowercase_name = zend_string_tolower_ex(internal_function->function_name, 1);
- lowercase_name = zend_new_interned_string(lowercase_name);
+ if (scope) {
+ lowercase_name = zend_new_interned_string(internal_function->function_name);
+ } else {
+ lowercase_name = zend_string_tolower_ex(internal_function->function_name, 1);
+ lowercase_name = zend_new_interned_string(lowercase_name);
+ }
reg_function = malloc(sizeof(zend_internal_function));
memcpy(reg_function, &function, sizeof(zend_internal_function));
if (zend_hash_add_ptr(target_function_table, lowercase_name, reg_function) == NULL) {
unload=1;
free(reg_function);
- zend_string_release(lowercase_name);
+ if (!scope) {
+ zend_string_release(lowercase_name);
+ }
break;
}
@@ -2398,7 +2404,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
ptr++;
count++;
- zend_string_release(lowercase_name);
+ if (!scope) {
+ zend_string_release(lowercase_name);
+ }
}
if (unload) { /* before unloading, display all remaining bad function in the module */
if (scope) {
@@ -2406,12 +2414,16 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
while (ptr->fname) {
fname_len = strlen(ptr->fname);
- lowercase_name = zend_string_alloc(fname_len, 0);
- zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len);
- if (zend_hash_exists(target_function_table, lowercase_name)) {
+ if (!scope) {
+ lowercase_name = zend_string_alloc(fname_len, 0);
+ zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len);
+ }
+ if (zend_hash_str_exists(target_function_table, ptr->fname, fname_len)) {
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
}
- zend_string_free(lowercase_name);
+ if (!scope) {
+ zend_string_free(lowercase_name);
+ }
ptr++;
}
zend_unregister_functions(functions, count, target_function_table);
@@ -2747,8 +2759,8 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, MODULE_PERSISTENT);
}
- lowercase_name = zend_string_tolower_ex(orig_class_entry->name, 1);
- lowercase_name = zend_new_interned_string(lowercase_name);
+ //lowercase_name = zend_string_tolower_ex(orig_class_entry->name, 1);
+ lowercase_name = zend_new_interned_string(orig_class_entry->name);
zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
zend_string_release(lowercase_name);
return class_entry;
@@ -2915,11 +2927,11 @@ static int zend_is_callable_check_class(zend_string *name, zend_class_entry *sco
int ret = 0;
zend_class_entry *ce;
size_t name_len = ZSTR_LEN(name);
- zend_string *lcname;
- ALLOCA_FLAG(use_heap);
+ zend_string *lcname = name;;
+ //ALLOCA_FLAG(use_heap);
- ZSTR_ALLOCA_ALLOC(lcname, name_len, use_heap);
- zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(name), name_len);
+ //ZSTR_ALLOCA_ALLOC(lcname, name_len, use_heap);
+ //zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(name), name_len);
*strict_class = 0;
if (zend_string_equals_literal(lcname, "self")) {
@@ -2989,7 +3001,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_class_entry *sco
} else {
if (error) zend_spprintf(error, 0, "class '%.*s' not found", (int)name_len, ZSTR_VAL(name));
}
- ZSTR_ALLOCA_FREE(lcname, use_heap);
+ //ZSTR_ALLOCA_FREE(lcname, use_heap);
return ret;
}
/* }}} */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 3517bc1..8993c36 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4071,7 +4071,7 @@ void zend_compile_method_call(znode *result, zend_ast *ast, uint32_t type) /* {{
/* Check if this calls a known method on $this */
if (opline->op1_type == IS_UNUSED && opline->op2_type == IS_CONST &&
CG(active_class_entry) && zend_is_scope_known()) {
- zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
+ zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2));
fbc = zend_hash_find_ptr(&CG(active_class_entry)->function_table, lcname);
/* We only know the exact method that is being called if it is either private or final.
@@ -4137,7 +4137,7 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
if (opline->op2_type == IS_CONST) {
zend_class_entry *ce = NULL;
if (opline->op1_type == IS_CONST) {
- zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op1) + 1);
+ zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op1));
ce = zend_hash_find_ptr(CG(class_table), lcname);
if (!ce && CG(active_class_entry)
&& zend_string_equals_ci(CG(active_class_entry)->name, lcname)) {
@@ -4149,7 +4149,7 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
ce = CG(active_class_entry);
}
if (ce) {
- zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
+ zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2));
fbc = zend_hash_find_ptr(&ce->function_table, lcname);
}
}
@@ -5743,9 +5743,8 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
op_array->scope = ce;
op_array->function_name = zend_string_copy(name);
-
- lcname = zend_string_tolower(name);
- lcname = zend_new_interned_string(lcname);
+ //lcname = zend_string_tolower(name);
+ op_array->function_name = lcname = zend_new_interned_string(name);
if (zend_hash_add_ptr(&ce->function_table, lcname, op_array) == NULL) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()",
@@ -5872,7 +5871,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
}
}
- zend_string_release(lcname);
+ //zend_string_release(lcname);
}
/* }}} */
@@ -6295,8 +6294,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
zend_assert_valid_class_name(unqualified_name);
name = zend_prefix_with_ns(unqualified_name);
- name = zend_new_interned_string(name);
- lcname = zend_string_tolower(name);
+ lcname = zend_new_interned_string(zend_string_copy(name));
if (FC(imports)) {
zend_string *import_name = zend_hash_find_ptr_lc(
@@ -6310,9 +6308,8 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
zend_register_seen_symbol(lcname, ZEND_SYMBOL_CLASS);
} else {
name = zend_generate_anon_class_name(decl->lex_pos);
- lcname = zend_string_tolower(name);
+ lcname = zend_new_interned_string(zend_string_copy(name));
}
- lcname = zend_new_interned_string(lcname);
ce->type = ZEND_USER_CLASS;
ce->name = name;
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 6269328..f8ecb0d 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -977,7 +977,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
zend_string *str, *file = NULL;
zend_long line = 0;
- zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &tmp);
+ zend_call_method_with_0_params(&exception, ce_exception, NULL, "__toString", &tmp);
if (!EG(exception)) {
if (Z_TYPE(tmp) != IS_STRING) {
zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name));
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 88eb419..fcae0dd 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -869,30 +869,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
zend_class_entry *ce = NULL;
zval args[1], *zv;
zval local_retval;
- zend_string *lc_name;
zend_fcall_info fcall_info;
zend_fcall_info_cache fcall_cache;
- if (key) {
- lc_name = Z_STR_P(key);
- } else {
- if (name == NULL || !ZSTR_LEN(name)) {
- return NULL;
- }
-
- if (ZSTR_VAL(name)[0] == '\\') {
- lc_name = zend_string_alloc(ZSTR_LEN(name) - 1, 0);
- zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1);
- } else {
- lc_name = zend_string_tolower(name);
- }
- }
-
- zv = zend_hash_find(EG(class_table), lc_name);
- if (zv) {
- if (!key) {
- zend_string_release(lc_name);
- }
+ if ((zv = zend_hash_find(EG(class_table), name))) {
return (zend_class_entry*)Z_PTR_P(zv);
}
@@ -900,9 +880,6 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
* (doesn't impact functionality of __autoload()
*/
if (!use_autoload || zend_is_compiling()) {
- if (!key) {
- zend_string_release(lc_name);
- }
return NULL;
}
@@ -911,9 +888,6 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
if (zv) {
EG(autoload_func) = (zend_function*)Z_PTR_P(zv);
} else {
- if (!key) {
- zend_string_release(lc_name);
- }
return NULL;
}
@@ -921,7 +895,6 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
/* Verify class name before passing it to __autoload() */
if (!key && strspn(ZSTR_VAL(name), "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != ZSTR_LEN(name)) {
- zend_string_release(lc_name);
return NULL;
}
@@ -930,10 +903,8 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
zend_hash_init(EG(in_autoload), 8, NULL, NULL, 0);
}
- if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
- if (!key) {
- zend_string_release(lc_name);
- }
+
+ if (zend_hash_add_empty_element(EG(in_autoload), name) == NULL) {
return NULL;
}
@@ -960,20 +931,17 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
zend_exception_save();
if ((zend_call_function(&fcall_info, &fcall_cache) == SUCCESS) && !EG(exception)) {
- ce = zend_hash_find_ptr(EG(class_table), lc_name);
+ ce = zend_hash_find_ptr(EG(class_table), name);
}
zend_exception_restore();
zval_ptr_dtor(&args[0]);
zval_dtor(&fcall_info.function_name);
- zend_hash_del(EG(in_autoload), lc_name);
+ zend_hash_del(EG(in_autoload), name);
zval_ptr_dtor(&local_retval);
- if (!key) {
- zend_string_release(lc_name);
- }
return ce;
}
/* }}} */
@@ -1393,8 +1361,8 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *
zend_class_entry *ce;
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) {
- return zend_lookup_class_ex(class_name, key, 0);
- } else if ((ce = zend_lookup_class_ex(class_name, key, 1)) == NULL) {
+ return zend_lookup_class_ex(class_name, NULL, 0);
+ } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
zend_throw_or_error(fetch_type, NULL, "Interface '%s' not found", ZSTR_VAL(class_name));
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 46a674b..ce382a3 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1149,8 +1149,8 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
} else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) {
ce->__debugInfo = fe;
} else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) {
- zend_string *lowercase_name = zend_string_tolower(ce->name);
- lowercase_name = zend_new_interned_string(lowercase_name);
+ //zend_string *lowercase_name = zend_string_tolower(ce->name);
+ zend_string *lowercase_name = zend_new_interned_string(ce->name);
if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) {
if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
@@ -1286,7 +1286,8 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
}
- lcname = zend_string_tolower(alias->alias);
+ //lcname = zend_string_tolower(alias->alias);
+ lcname = alias->alias;
zend_add_trait_method(ce, ZSTR_VAL(alias->alias), lcname, &fn_copy, overriden);
zend_string_release(lcname);
@@ -1377,7 +1378,8 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */
zend_check_trait_usage(ce, cur_precedence->trait_method->ce);
/** Ensure that the preferred method is actually available. */
- lcname = zend_string_tolower(cur_method_ref->method_name);
+ //lcname = zend_string_tolower(cur_method_ref->method_name);
+ lcname = cur_method_ref->method_name;
method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
lcname);
zend_string_release(lcname);
@@ -1435,7 +1437,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */
zend_check_trait_usage(ce, cur_method_ref->ce);
/** And, ensure that the referenced method is resolvable, too. */
- lcname = zend_string_tolower(cur_method_ref->method_name);
+ lcname = cur_method_ref->method_name;
method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
lcname);
zend_string_release(lcname);
@@ -1462,8 +1464,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra
j = 0;
while (precedences[i]->exclude_from_classes[j].ce) {
if (precedences[i]->exclude_from_classes[j].ce == trait) {
- zend_string *lcname =
- zend_string_tolower(precedences[i]->trait_method->method_name);
+ zend_string *lcname = precedences[i]->trait_method->method_name;
if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) {
zend_string_release(lcname);
zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", ZSTR_VAL(precedences[i]->trait_method->method_name), ZSTR_VAL(trait->name));
@@ -1693,8 +1694,7 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce)
2) it is just a plain old inconsitency/typo/bug
as in the case where alias is set. */
- lc_method_name = zend_string_tolower(
- cur_alias->trait_method->method_name);
+ lc_method_name = cur_alias->trait_method->method_name;
if (zend_hash_exists(&ce->function_table,
lc_method_name)) {
zend_string_release(lc_method_name);
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 5b88af5..52b9a1b 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -786,7 +786,7 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /*
ZVAL_COPY(&tmp_object, object);
if (type == BP_VAR_IS) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", rv, &tmp_offset);
+ zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetExists", rv, &tmp_offset);
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
@@ -833,7 +833,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /*
ZVAL_COPY(&tmp_offset, offset);
}
ZVAL_COPY(&tmp_object, object);
- zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
+ zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetSet", NULL, &tmp_offset, value);
zval_ptr_dtor(&tmp_object);
zval_ptr_dtor(&tmp_offset);
} else {
@@ -852,12 +852,12 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /
ZVAL_DEREF(offset);
ZVAL_COPY(&tmp_offset, offset);
ZVAL_COPY(&tmp_object, object);
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", &retval, &tmp_offset);
+ zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetExists", &retval, &tmp_offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", &retval, &tmp_offset);
+ zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetGet", &retval, &tmp_offset);
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
@@ -1165,21 +1165,22 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
zend_function *fbc;
zend_string *lc_method_name;
zend_class_entry *scope = NULL;
- ALLOCA_FLAG(use_heap);
+ //ALLOCA_FLAG(use_heap);
- if (EXPECTED(key != NULL)) {
- lc_method_name = Z_STR_P(key);
+ //if (EXPECTED(key != NULL)) {
+ // lc_method_name = Z_STR_P(key);
#ifdef ZEND_ALLOCA_MAX_SIZE
- use_heap = 0;
+ // use_heap = 0;
#endif
- } else {
- ZSTR_ALLOCA_ALLOC(lc_method_name, ZSTR_LEN(method_name), use_heap);
- zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
- }
+ //} else {
+ //ZSTR_ALLOCA_ALLOC(lc_method_name, ZSTR_LEN(method_name), use_heap);
+ //zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
+ lc_method_name = method_name;
+ //}
if (UNEXPECTED((func = zend_hash_find(&zobj->ce->function_table, lc_method_name)) == NULL)) {
if (UNEXPECTED(!key)) {
- ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
+ //ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
}
if (zobj->ce->__call) {
return zend_get_user_call_function(zobj->ce, method_name);
@@ -1242,7 +1243,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
}
if (UNEXPECTED(!key)) {
- ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
+ //ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
}
return fbc;
}
@@ -1261,11 +1262,12 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
zend_object *object;
zend_class_entry *scope;
- if (EXPECTED(key != NULL)) {
- lc_function_name = Z_STR_P(key);
- } else {
- lc_function_name = zend_string_tolower(function_name);
- }
+ //if (EXPECTED(key != NULL)) {
+ // lc_function_name = Z_STR_P(key);
+// } else {
+ // lc_function_name = zend_string_tolower(function_name);
+ lc_function_name = function_name;
+ //}
do {
zval *func = zend_hash_find(&ce->function_table, lc_function_name);
@@ -1282,7 +1284,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
fbc = ce->constructor;
} else {
if (UNEXPECTED(!key)) {
- zend_string_release(lc_function_name);
+ // zend_string_release(lc_function_name);
}
if (ce->__call &&
(object = zend_get_this_object(EG(current_execute_data))) != NULL &&
@@ -1345,7 +1347,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
if (UNEXPECTED(!key)) {
- zend_string_release(lc_function_name);
+ // zend_string_release(lc_function_name);
}
return fbc;
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index ffc0485..6c9669c 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -888,7 +888,7 @@ static zend_class_entry *get_class_entry_from_op1(
if (opline->op1_type == IS_CONST) {
zval *op1 = CRT_CONSTANT_EX(op_array, opline, opline->op1, rt_constants);
if (Z_TYPE_P(op1) == IS_STRING) {
- zend_string *class_name = Z_STR_P(op1 + 1);
+ zend_string *class_name = Z_STR_P(op1);
zend_class_entry *ce;
if (script && (ce = zend_hash_find_ptr(&script->class_table, class_name))) {
return ce;
@@ -955,7 +955,7 @@ zend_function *zend_optimizer_get_called_func(
zend_class_entry *ce = get_class_entry_from_op1(
script, op_array, opline, rt_constants);
if (ce) {
- zend_string *func_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *func_name = Z_STR_P(GET_OP(op2));
return zend_hash_find_ptr(&ce->function_table, func_name);
}
}
@@ -964,7 +964,7 @@ zend_function *zend_optimizer_get_called_func(
if (opline->op1_type == IS_UNUSED
&& opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING
&& op_array->scope && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)) {
- zend_string *method_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *method_name = Z_STR_P(GET_OP(op2));
zend_function *fbc = zend_hash_find_ptr(
&op_array->scope->function_table, method_name);
if (fbc) {
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 9e21f8d..2d51bcd 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1556,9 +1556,9 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
}
/* }}} */
-/* {{{ proto void RecursiveDirectoryIterator::getSubPathname()
+/* {{{ proto void RecursiveDirectoryIterator::getSubPathName()
Get sub path and file name */
-SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
+SPL_METHOD(RecursiveDirectoryIterator, getSubPathName)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
@@ -1996,7 +1996,7 @@ static const zend_function_entry spl_RecursiveDirectoryIterator_functions[] = {
SPL_ME(RecursiveDirectoryIterator, hasChildren, arginfo_r_dir_hasChildren, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getChildren, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getSubPath, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator, getSubPathname,arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
+ SPL_ME(RecursiveDirectoryIterator, getSubPathName,arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 2cf658a..b266044 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -271,7 +271,7 @@ next_step:
if (object->callHasChildren) {
zend_call_method_with_0_params(zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(zobject, ce, NULL, "hasChildren", &retval);
}
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
@@ -496,7 +496,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs.zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs.zf_new_iterator, "getIterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -524,7 +524,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs.zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs.zf_new_iterator, "getIterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -553,31 +553,31 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
intern->in_iteration = 0;
intern->ce = Z_OBJCE_P(object);
- intern->beginIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "beginiteration", sizeof("beginiteration") - 1);
+ intern->beginIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "beginIteration", sizeof("beginiteration") - 1);
if (intern->beginIteration->common.scope == ce_base) {
intern->beginIteration = NULL;
}
- intern->endIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "enditeration", sizeof("enditeration") - 1);
+ intern->endIteration = zend_hash_str_find_ptr(&intern->ce->function_table, "endIteration", sizeof("enditeration") - 1);
if (intern->endIteration->common.scope == ce_base) {
intern->endIteration = NULL;
}
- intern->callHasChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren") - 1);
+ intern->callHasChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callHasChildren", sizeof("callHasChildren") - 1);
if (intern->callHasChildren->common.scope == ce_base) {
intern->callHasChildren = NULL;
}
- intern->callGetChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren") - 1);
+ intern->callGetChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "callGetChildren", sizeof("callGetChildren") - 1);
if (intern->callGetChildren->common.scope == ce_base) {
intern->callGetChildren = NULL;
}
- intern->beginChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "beginchildren", sizeof("beginchildren") - 1);
+ intern->beginChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "beginChildren", sizeof("beginchildren") - 1);
if (intern->beginChildren->common.scope == ce_base) {
intern->beginChildren = NULL;
}
- intern->endChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "endchildren", sizeof("endchildren") - 1);
+ intern->endChildren = zend_hash_str_find_ptr(&intern->ce->function_table, "endChildren", sizeof("endchildren") - 1);
if (intern->endChildren->common.scope == ce_base) {
intern->endChildren = NULL;
}
- intern->nextElement = zend_hash_str_find_ptr(&intern->ce->function_table, "nextelement", sizeof("nextElement") - 1);
+ intern->nextElement = zend_hash_str_find_ptr(&intern->ce->function_table, "nextElement", sizeof("nextElement") - 1);
if (intern->nextElement->common.scope == ce_base) {
intern->nextElement = NULL;
}
@@ -788,7 +788,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
RETURN_FALSE;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", return_value);
+ zend_call_method_with_0_params(zobject, ce, NULL, "hasChildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_FALSE;
}
@@ -1522,7 +1522,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
ce = ce_cast;
}
if (instanceof_function(ce, zend_ce_aggregate)) {
- zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
+ zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getIterator", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
return NULL;
@@ -1927,7 +1927,7 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "hasChildren", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETURN_ZVAL(&retval, 0, 1);
} else {
@@ -2659,7 +2659,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
/* Recursion ? */
if (intern->dit_type == DIT_RecursiveCachingIterator) {
zval retval, zchildren, zflags;
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "hasChildren", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -2669,7 +2669,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
}
} else {
if (zend_is_true(&retval)) {
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
+ zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getChildren", &zchildren);
if (EG(exception)) {
zval_ptr_dtor(&zchildren);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment