MFZE1 zend_str_tolower issue.

This commit is contained in:
Ilia Alshanetsky 2002-10-09 14:21:40 +00:00
parent 6b3820a510
commit d3617c51b8
10 changed files with 29 additions and 41 deletions

View File

@ -1229,7 +1229,7 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *orig_c
char *lowercase_name = zend_strndup(orig_class_entry->name, orig_class_entry->name_length);
*class_entry = *orig_class_entry;
zend_str_tolower_nlc(lowercase_name, class_entry->name_length);
zend_str_tolower(lowercase_name, class_entry->name_length);
class_entry->type = ZEND_INTERNAL_CLASS;
class_entry->parent = NULL;
@ -1326,7 +1326,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
return 1;
lcname = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
zend_str_tolower_nlc(lcname, Z_STRLEN_P(callable));
zend_str_tolower(lcname, Z_STRLEN_P(callable));
if (zend_hash_exists(EG(function_table), lcname, Z_STRLEN_P(callable)+1))
retval = 1;
efree(lcname);
@ -1362,7 +1362,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
return 1;
lcname = estrndup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
zend_str_tolower_nlc(lcname, Z_STRLEN_PP(obj));
zend_str_tolower(lcname, Z_STRLEN_PP(obj));
if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
}
@ -1389,7 +1389,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
if (ce) {
lcname = estrndup(Z_STRVAL_PP(method), Z_STRLEN_PP(method));
zend_str_tolower_nlc(lcname, Z_STRLEN_PP(method));
zend_str_tolower(lcname, Z_STRLEN_PP(method));
if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1))
retval = 1;
efree(lcname);

View File

@ -568,7 +568,7 @@ ZEND_FUNCTION(get_parent_class)
zend_class_entry **pce;
SEPARATE_ZVAL(arg);
zend_str_tolower_nlc(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
zend_str_tolower(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
}
@ -605,7 +605,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
convert_to_string_ex(class_name);
lcname = estrndup(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name));
zend_str_tolower_nlc(lcname, Z_STRLEN_PP(class_name));
zend_str_tolower(lcname, Z_STRLEN_PP(class_name));
if (only_subclass)
ce = Z_OBJCE_PP(obj)->parent;
@ -655,7 +655,7 @@ ZEND_FUNCTION(get_class_vars)
convert_to_string_ex(class_name);
lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
zend_str_tolower_nlc(lcname, (*class_name)->value.str.len);
zend_str_tolower(lcname, (*class_name)->value.str.len);
if (zend_lookup_class(lcname, Z_STRLEN_PP(class_name), &pce TSRMLS_CC) == FAILURE) {
efree(lcname);
@ -722,7 +722,7 @@ ZEND_FUNCTION(get_class_methods)
ce = Z_OBJCE_PP(class);
} else if (Z_TYPE_PP(class) == IS_STRING) {
SEPARATE_ZVAL(class);
zend_str_tolower_nlc(Z_STRVAL_PP(class), Z_STRLEN_PP(class));
zend_str_tolower(Z_STRVAL_PP(class), Z_STRLEN_PP(class));
if (zend_lookup_class(Z_STRVAL_PP(class), Z_STRLEN_PP(class), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
@ -768,7 +768,7 @@ ZEND_FUNCTION(method_exists)
convert_to_string_ex(method_name);
lcname = estrndup((*method_name)->value.str.val, (*method_name)->value.str.len);
zend_str_tolower_nlc(lcname, (*method_name)->value.str.len);
zend_str_tolower(lcname, (*method_name)->value.str.len);
if (zend_hash_exists(&Z_OBJCE_PP(klass)->function_table, lcname, (*method_name)->value.str.len+1)) {
efree(lcname);
RETURN_TRUE;
@ -792,7 +792,7 @@ ZEND_FUNCTION(class_exists)
}
convert_to_string_ex(class_name);
lcname = estrndup((*class_name)->value.str.val, (*class_name)->value.str.len);
zend_str_tolower_nlc(lcname, (*class_name)->value.str.len);
zend_str_tolower(lcname, (*class_name)->value.str.len);
if (zend_hash_exists(EG(class_table), lcname, (*class_name)->value.str.len+1)) {
efree(lcname);
RETURN_TRUE;
@ -818,7 +818,7 @@ ZEND_FUNCTION(function_exists)
}
convert_to_string_ex(function_name);
lcname = estrndup((*function_name)->value.str.val, (*function_name)->value.str.len);
zend_str_tolower_nlc(lcname, (*function_name)->value.str.len);
zend_str_tolower(lcname, (*function_name)->value.str.len);
retval = (zend_hash_find(EG(function_table), lcname, (*function_name)->value.str.len+1, (void **)&func) == SUCCESS);
efree(lcname);

View File

@ -671,7 +671,7 @@ void zend_do_import(int type, znode *what TSRMLS_DC)
if (what) {
if (type == T_FUNCTION || type == T_CLASS) {
zend_str_tolower_nlc(what->u.constant.value.str.val, what->u.constant.value.str.len);
zend_str_tolower(what->u.constant.value.str.val, what->u.constant.value.str.len);
}
opline.op2 = *what;
} else {
@ -845,7 +845,7 @@ void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC)
static void zend_lowercase_znode_if_const(znode *z)
{
if (z->op_type == IS_CONST) {
zend_str_tolower_nlc(z->u.constant.value.str.val, z->u.constant.value.str.len);
zend_str_tolower(z->u.constant.value.str.val, z->u.constant.value.str.len);
}
}
@ -904,7 +904,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
int function_begin_line = function_token->u.opline_num;
function_token->u.op_array = CG(active_op_array);
zend_str_tolower_nlc(name, name_len);
zend_str_tolower(name, name_len);
init_op_array(&op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
@ -1036,7 +1036,7 @@ int zend_do_begin_function_call(znode *function_name TSRMLS_DC)
{
zend_function *function;
zend_str_tolower_nlc(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len);
zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len);
if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val, function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) {
zend_do_begin_dynamic_function_call(function_name TSRMLS_CC);
return 1; /* Dynamic */
@ -1130,7 +1130,7 @@ void do_fetch_class(znode *result, znode *class_entry, znode *class_name TSRMLS_
SET_UNUSED(opline->op1);
CG(catch_begin) = fetch_class_op_number;
}
zend_str_tolower_nlc(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
if ((class_name->u.constant.value.str.len == (sizeof("self") - 1)) &&
!memcmp(class_name->u.constant.value.str.val, "self", sizeof("self"))) {
SET_UNUSED(opline->op2);
@ -1165,7 +1165,7 @@ void do_fetch_class_name(znode *result, znode *class_name_entry, znode *class_na
*result = *class_name_entry;
}
if (!case_sensitive) {
zend_str_tolower_nlc(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
}
length = sizeof("::")-1 + result->u.constant.value.str.len + class_name->u.constant.value.str.len;
@ -1546,7 +1546,7 @@ static void create_class(HashTable *class_table, char *name, int name_length, ze
new_class_entry->refcount = 1;
new_class_entry->constants_updated = 0;
zend_str_tolower_nlc(new_class_entry->name, new_class_entry->name_length);
zend_str_tolower(new_class_entry->name, new_class_entry->name_length);
zend_hash_init(&new_class_entry->function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
zend_hash_init(&new_class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 0);
@ -2019,7 +2019,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
new_class_entry->refcount = 1;
new_class_entry->constants_updated = 0;
zend_str_tolower_nlc(new_class_entry->name, new_class_entry->name_length);
zend_str_tolower(new_class_entry->name, new_class_entry->name_length);
zend_hash_init(&new_class_entry->function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
zend_hash_init(&new_class_entry->class_table, 10, NULL, ZEND_CLASS_DTOR, 0);

View File

@ -214,7 +214,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
lookup_name = do_alloca(name_len+1);
memcpy(lookup_name, name, name_len+1);
zend_str_tolower_nlc(lookup_name, name_len);
zend_str_tolower(lookup_name, name_len);
if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
@ -249,7 +249,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
memcpy(lowercase_name, c->name, c->name_len);
if (!(c->flags & CONST_CS)) {
zend_str_tolower_nlc(lowercase_name, c->name_len);
zend_str_tolower(lowercase_name, c->name_len);
}
if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {

View File

@ -1837,7 +1837,7 @@ binary_assign_op_addr_obj:
tmp = *class_name;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
zend_str_tolower_nlc(tmp.value.str.val, tmp.value.str.len);
zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
class_name_strval = tmp.value.str.val;
class_name_strlen = tmp.value.str.len;
@ -1970,7 +1970,7 @@ binary_assign_op_addr_obj:
tmp = *function_name;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
zend_str_tolower_nlc(tmp.value.str.val, tmp.value.str.len);
zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
function_name_strval = tmp.value.str.val;
function_name_strlen = tmp.value.str.len;
@ -2019,7 +2019,7 @@ binary_assign_op_addr_obj:
tmp = *function_name;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
zend_str_tolower_nlc(tmp.value.str.val, tmp.value.str.len);
zend_str_tolower(tmp.value.str.val, tmp.value.str.len);
function_name_strval = tmp.value.str.val;
function_name_strlen = tmp.value.str.len;

View File

@ -531,7 +531,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
int found;
lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
zend_str_tolower_nlc(lc_class, Z_STRLEN_PP(object_pp));
zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp));
found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC);
efree(lc_class);
if (found == FAILURE)
@ -550,7 +550,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
function_name_copy = *function_name;
zval_copy_ctor(&function_name_copy);
zend_str_tolower_nlc(function_name_copy.value.str.val, function_name_copy.value.str.len);
zend_str_tolower(function_name_copy.value.str.val, function_name_copy.value.str.len);
original_function_state_ptr = EG(function_state_ptr);
if (zend_hash_find(function_table, function_name_copy.value.str.val, function_name_copy.value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {

View File

@ -291,7 +291,7 @@ extends_from:
declaration_class_name:
| parse_class_name_entry T_STRING { do_fetch_class_name(&$$, &$1, &$2, 0 TSRMLS_CC); }
| T_STRING { $$ = $1; zend_str_tolower_nlc($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
| T_STRING { $$ = $1; zend_str_tolower($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
;
foreach_optional_arg:
@ -577,7 +577,7 @@ parse_class_entry:
parse_class_name_entry:
parse_class_name_entry T_STRING T_PAAMAYIM_NEKUDOTAYIM { do_fetch_class_name(&$$, &$1, &$2, 0 TSRMLS_CC); }
| T_STRING T_PAAMAYIM_NEKUDOTAYIM { $$ = $1; zend_str_tolower_nlc($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
| T_STRING T_PAAMAYIM_NEKUDOTAYIM { $$ = $1; zend_str_tolower($$.u.constant.value.str.val, $$.u.constant.value.str.len); }
;
catch_or_import_class_entry:

View File

@ -379,7 +379,7 @@ static union _zend_function *zend_std_get_method(zval *object, char *method_name
lc_method_name = do_alloca(method_len+1);
/* Create a zend_copy_str_tolower(dest, src, src_length); */
memcpy(lc_method_name, method_name, method_len+1);
zend_str_tolower_nlc(lc_method_name, method_len);
zend_str_tolower(lc_method_name, method_len);
zobj = Z_OBJ_P(object);
if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&func_method) == FAILURE) {

View File

@ -1570,21 +1570,10 @@ ZEND_API int zval_is_true(zval *op)
return (op->value.lval ? 1 : 0);
}
ZEND_API void zend_str_tolower(char *str, unsigned int length)
{
register char *p=str, *end=p+length;
while (p<end) {
*p = tolower(*p);
p++;
}
}
ZEND_API void zend_str_tolower_nlc(char *str, unsigned int length)
{
register char *p=str, *end=p+length;
while (p<end) {
if (*p >= 'A' && *p <= 'Z') {
*p = (*p)+32;

View File

@ -171,7 +171,6 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
ZEND_API void zend_str_tolower(char *str, unsigned int length);
ZEND_API void zend_str_tolower_nlc(char *str, unsigned int length);
ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);