@@ -1972,35 +1972,35 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce,
1972
1972
zend_str_tolower_copy (lcname , fptr -> common .function_name , MIN (name_len , sizeof (lcname )- 1 ));
1973
1973
lcname [sizeof (lcname )- 1 ] = '\0' ; /* zend_str_tolower_copy won't necessarily set the zero byte */
1974
1974
1975
- if (name_len == sizeof (ZEND_DESTRUCTOR_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_DESTRUCTOR_FUNC_NAME , sizeof (ZEND_DESTRUCTOR_FUNC_NAME )) && fptr -> common .num_args != 0 ) {
1975
+ if (name_len == sizeof (ZEND_DESTRUCTOR_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_DESTRUCTOR_FUNC_NAME , sizeof (ZEND_DESTRUCTOR_FUNC_NAME ) - 1 ) && fptr -> common .num_args != 0 ) {
1976
1976
zend_error (error_type , "Destructor %s::%s() cannot take arguments" , ce -> name , ZEND_DESTRUCTOR_FUNC_NAME );
1977
- } else if (name_len == sizeof (ZEND_CLONE_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_CLONE_FUNC_NAME , sizeof (ZEND_CLONE_FUNC_NAME )) && fptr -> common .num_args != 0 ) {
1977
+ } else if (name_len == sizeof (ZEND_CLONE_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_CLONE_FUNC_NAME , sizeof (ZEND_CLONE_FUNC_NAME ) - 1 ) && fptr -> common .num_args != 0 ) {
1978
1978
zend_error (error_type , "Method %s::%s() cannot accept any arguments" , ce -> name , ZEND_CLONE_FUNC_NAME );
1979
- } else if (name_len == sizeof (ZEND_GET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_GET_FUNC_NAME , sizeof (ZEND_GET_FUNC_NAME ))) {
1979
+ } else if (name_len == sizeof (ZEND_GET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_GET_FUNC_NAME , sizeof (ZEND_GET_FUNC_NAME ) - 1 )) {
1980
1980
if (fptr -> common .num_args != 1 ) {
1981
1981
zend_error (error_type , "Method %s::%s() must take exactly 1 argument" , ce -> name , ZEND_GET_FUNC_NAME );
1982
1982
} else if (ARG_SHOULD_BE_SENT_BY_REF (fptr , 1 )) {
1983
1983
zend_error (error_type , "Method %s::%s() cannot take arguments by reference" , ce -> name , ZEND_GET_FUNC_NAME );
1984
1984
}
1985
- } else if (name_len == sizeof (ZEND_SET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_SET_FUNC_NAME , sizeof (ZEND_SET_FUNC_NAME ))) {
1985
+ } else if (name_len == sizeof (ZEND_SET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_SET_FUNC_NAME , sizeof (ZEND_SET_FUNC_NAME ) - 1 )) {
1986
1986
if (fptr -> common .num_args != 2 ) {
1987
1987
zend_error (error_type , "Method %s::%s() must take exactly 2 arguments" , ce -> name , ZEND_SET_FUNC_NAME );
1988
1988
} else if (ARG_SHOULD_BE_SENT_BY_REF (fptr , 1 ) || ARG_SHOULD_BE_SENT_BY_REF (fptr , 2 )) {
1989
1989
zend_error (error_type , "Method %s::%s() cannot take arguments by reference" , ce -> name , ZEND_SET_FUNC_NAME );
1990
1990
}
1991
- } else if (name_len == sizeof (ZEND_UNSET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_UNSET_FUNC_NAME , sizeof (ZEND_UNSET_FUNC_NAME ))) {
1991
+ } else if (name_len == sizeof (ZEND_UNSET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_UNSET_FUNC_NAME , sizeof (ZEND_UNSET_FUNC_NAME ) - 1 )) {
1992
1992
if (fptr -> common .num_args != 1 ) {
1993
1993
zend_error (error_type , "Method %s::%s() must take exactly 1 argument" , ce -> name , ZEND_UNSET_FUNC_NAME );
1994
1994
} else if (ARG_SHOULD_BE_SENT_BY_REF (fptr , 1 )) {
1995
1995
zend_error (error_type , "Method %s::%s() cannot take arguments by reference" , ce -> name , ZEND_UNSET_FUNC_NAME );
1996
1996
}
1997
- } else if (name_len == sizeof (ZEND_ISSET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_ISSET_FUNC_NAME , sizeof (ZEND_ISSET_FUNC_NAME ))) {
1997
+ } else if (name_len == sizeof (ZEND_ISSET_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_ISSET_FUNC_NAME , sizeof (ZEND_ISSET_FUNC_NAME ) - 1 )) {
1998
1998
if (fptr -> common .num_args != 1 ) {
1999
1999
zend_error (error_type , "Method %s::%s() must take exactly 1 argument" , ce -> name , ZEND_ISSET_FUNC_NAME );
2000
2000
} else if (ARG_SHOULD_BE_SENT_BY_REF (fptr , 1 )) {
2001
2001
zend_error (error_type , "Method %s::%s() cannot take arguments by reference" , ce -> name , ZEND_ISSET_FUNC_NAME );
2002
2002
}
2003
- } else if (name_len == sizeof (ZEND_CALL_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_CALL_FUNC_NAME , sizeof (ZEND_CALL_FUNC_NAME ))) {
2003
+ } else if (name_len == sizeof (ZEND_CALL_FUNC_NAME ) - 1 && !memcmp (lcname , ZEND_CALL_FUNC_NAME , sizeof (ZEND_CALL_FUNC_NAME ) - 1 )) {
2004
2004
if (fptr -> common .num_args != 2 ) {
2005
2005
zend_error (error_type , "Method %s::%s() must take exactly 2 arguments" , ce -> name , ZEND_CALL_FUNC_NAME );
2006
2006
} else if (ARG_SHOULD_BE_SENT_BY_REF (fptr , 1 ) || ARG_SHOULD_BE_SENT_BY_REF (fptr , 2 )) {
@@ -2157,28 +2157,28 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
2157
2157
*/
2158
2158
if ((fname_len == class_name_len ) && !ctor && !memcmp (lowercase_name , lc_class_name , class_name_len + 1 )) {
2159
2159
ctor = reg_function ;
2160
- } else if ((fname_len == sizeof (ZEND_CONSTRUCTOR_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CONSTRUCTOR_FUNC_NAME , sizeof (ZEND_CONSTRUCTOR_FUNC_NAME ))) {
2160
+ } else if ((fname_len == sizeof (ZEND_CONSTRUCTOR_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CONSTRUCTOR_FUNC_NAME , sizeof (ZEND_CONSTRUCTOR_FUNC_NAME ) - 1 )) {
2161
2161
ctor = reg_function ;
2162
- } else if ((fname_len == sizeof (ZEND_DESTRUCTOR_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_DESTRUCTOR_FUNC_NAME , sizeof (ZEND_DESTRUCTOR_FUNC_NAME ))) {
2162
+ } else if ((fname_len == sizeof (ZEND_DESTRUCTOR_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_DESTRUCTOR_FUNC_NAME , sizeof (ZEND_DESTRUCTOR_FUNC_NAME ) - 1 )) {
2163
2163
dtor = reg_function ;
2164
2164
if (internal_function -> num_args ) {
2165
2165
zend_error (error_type , "Destructor %s::%s() cannot take arguments" , scope -> name , ptr -> fname );
2166
2166
}
2167
- } else if ((fname_len == sizeof (ZEND_CLONE_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CLONE_FUNC_NAME , sizeof (ZEND_CLONE_FUNC_NAME ))) {
2167
+ } else if ((fname_len == sizeof (ZEND_CLONE_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CLONE_FUNC_NAME , sizeof (ZEND_CLONE_FUNC_NAME ) - 1 )) {
2168
2168
clone = reg_function ;
2169
- } else if ((fname_len == sizeof (ZEND_CALL_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CALL_FUNC_NAME , sizeof (ZEND_CALL_FUNC_NAME ))) {
2169
+ } else if ((fname_len == sizeof (ZEND_CALL_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CALL_FUNC_NAME , sizeof (ZEND_CALL_FUNC_NAME ) - 1 )) {
2170
2170
__call = reg_function ;
2171
- } else if ((fname_len == sizeof (ZEND_CALLSTATIC_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CALLSTATIC_FUNC_NAME , sizeof (ZEND_CALLSTATIC_FUNC_NAME ))) {
2171
+ } else if ((fname_len == sizeof (ZEND_CALLSTATIC_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_CALLSTATIC_FUNC_NAME , sizeof (ZEND_CALLSTATIC_FUNC_NAME ) - 1 )) {
2172
2172
__callstatic = reg_function ;
2173
- } else if ((fname_len == sizeof (ZEND_TOSTRING_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_TOSTRING_FUNC_NAME , sizeof (ZEND_TOSTRING_FUNC_NAME ))) {
2173
+ } else if ((fname_len == sizeof (ZEND_TOSTRING_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_TOSTRING_FUNC_NAME , sizeof (ZEND_TOSTRING_FUNC_NAME ) - 1 )) {
2174
2174
__tostring = reg_function ;
2175
- } else if ((fname_len == sizeof (ZEND_GET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_GET_FUNC_NAME , sizeof (ZEND_GET_FUNC_NAME ))) {
2175
+ } else if ((fname_len == sizeof (ZEND_GET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_GET_FUNC_NAME , sizeof (ZEND_GET_FUNC_NAME ) - 1 )) {
2176
2176
__get = reg_function ;
2177
- } else if ((fname_len == sizeof (ZEND_SET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_SET_FUNC_NAME , sizeof (ZEND_SET_FUNC_NAME ))) {
2177
+ } else if ((fname_len == sizeof (ZEND_SET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_SET_FUNC_NAME , sizeof (ZEND_SET_FUNC_NAME ) - 1 )) {
2178
2178
__set = reg_function ;
2179
- } else if ((fname_len == sizeof (ZEND_UNSET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_UNSET_FUNC_NAME , sizeof (ZEND_UNSET_FUNC_NAME ))) {
2179
+ } else if ((fname_len == sizeof (ZEND_UNSET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_UNSET_FUNC_NAME , sizeof (ZEND_UNSET_FUNC_NAME ) - 1 )) {
2180
2180
__unset = reg_function ;
2181
- } else if ((fname_len == sizeof (ZEND_ISSET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_ISSET_FUNC_NAME , sizeof (ZEND_ISSET_FUNC_NAME ))) {
2181
+ } else if ((fname_len == sizeof (ZEND_ISSET_FUNC_NAME )- 1 ) && !memcmp (lowercase_name , ZEND_ISSET_FUNC_NAME , sizeof (ZEND_ISSET_FUNC_NAME ) - 1 )) {
2182
2182
__isset = reg_function ;
2183
2183
} else {
2184
2184
reg_function = NULL ;
@@ -2830,7 +2830,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
2830
2830
if (strict_class &&
2831
2831
fcc -> calling_scope &&
2832
2832
mlen == sizeof (ZEND_CONSTRUCTOR_FUNC_NAME )- 1 &&
2833
- !memcmp (lmname , ZEND_CONSTRUCTOR_FUNC_NAME , sizeof (ZEND_CONSTRUCTOR_FUNC_NAME ))) {
2833
+ !memcmp (lmname , ZEND_CONSTRUCTOR_FUNC_NAME , sizeof (ZEND_CONSTRUCTOR_FUNC_NAME ) - 1 )) {
2834
2834
fcc -> function_handler = fcc -> calling_scope -> constructor ;
2835
2835
if (fcc -> function_handler ) {
2836
2836
retval = 1 ;
0 commit comments