summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 4248de834d..639016179f 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -110,8 +110,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
target = intern->ptr; \
/* Class constants */
-#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value) \
- zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+#define REGISTER_REFLECTION_CLASS_CONST_INT(class_name, const_name, value) \
+ zend_declare_class_constant_int(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
/* {{{ Smart string functions */
typedef struct _string {
@@ -738,8 +738,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
string_write(str, "NULL", sizeof("NULL")-1);
} else if (Z_TYPE(zv) == IS_STRING) {
string_write(str, "'", sizeof("'")-1);
- string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
- if (Z_STRLEN(zv) > 15) {
+ string_write(str, Z_STRVAL(zv), MIN(Z_STRSIZE(zv), 15));
+ if (Z_STRSIZE(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
@@ -1817,7 +1817,7 @@ ZEND_METHOD(reflection_function, getStartLine)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_LONG(fptr->op_array.line_start);
+ RETURN_INT(fptr->op_array.line_start);
}
RETURN_FALSE;
}
@@ -1835,7 +1835,7 @@ ZEND_METHOD(reflection_function, getEndLine)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_LONG(fptr->op_array.line_end);
+ RETURN_INT(fptr->op_array.line_end);
}
RETURN_FALSE;
}
@@ -2018,7 +2018,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
METHOD_NOTSTATIC(reflection_function_abstract_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
- RETURN_LONG(fptr->common.num_args);
+ RETURN_INT(fptr->common.num_args);
}
/* }}} */
@@ -2032,7 +2032,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
METHOD_NOTSTATIC(reflection_function_abstract_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
- RETURN_LONG(fptr->common.required_num_args);
+ RETURN_INT(fptr->common.required_num_args);
}
/* }}} */
@@ -2149,7 +2149,7 @@ ZEND_METHOD(reflection_parameter, __construct)
unsigned int lcname_len;
char *lcname;
- lcname_len = Z_STRLEN_P(reference);
+ lcname_len = Z_STRSIZE_P(reference);
lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len);
if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) {
efree(lcname);
@@ -2187,7 +2187,7 @@ ZEND_METHOD(reflection_parameter, __construct)
}
convert_to_string_ex(method);
- lcname_len = Z_STRLEN_P(method);
+ lcname_len = Z_STRSIZE_P(method);
lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len);
if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT
&& (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
@@ -2228,8 +2228,8 @@ ZEND_METHOD(reflection_parameter, __construct)
/* Now, search for the parameter */
arg_info = fptr->common.arg_info;
- if (Z_TYPE_P(parameter) == IS_LONG) {
- position= Z_LVAL_P(parameter);
+ if (Z_TYPE_P(parameter) == IS_INT) {
+ position= Z_IVAL_P(parameter);
if (position < 0 || (zend_uint)position >= fptr->common.num_args) {
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
@@ -2512,7 +2512,7 @@ ZEND_METHOD(reflection_parameter, getPosition)
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_LONG(param->offset);
+ RETVAL_INT(param->offset);
}
/* }}} */
@@ -3112,7 +3112,7 @@ ZEND_METHOD(reflection_function, inNamespace)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
@@ -3135,7 +3135,7 @@ ZEND_METHOD(reflection_function, getNamespaceName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
@@ -3158,10 +3158,10 @@ ZEND_METHOD(reflection_function, getShortName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
+ RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
RETURN_ZVAL(name, 1, 0);
}
@@ -3212,7 +3212,7 @@ ZEND_METHOD(reflection_method, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(mptr);
- RETURN_LONG(mptr->common.fn_flags);
+ RETURN_INT(mptr->common.fn_flags);
}
/* }}} */
@@ -3575,7 +3575,7 @@ ZEND_METHOD(reflection_class, getStartLine)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_FUNCTION) {
- RETURN_LONG(ce->info.user.line_start);
+ RETURN_INT(ce->info.user.line_start);
}
RETURN_FALSE;
}
@@ -3593,7 +3593,7 @@ ZEND_METHOD(reflection_class, getEndLine)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_LONG(ce->info.user.line_end);
+ RETURN_INT(ce->info.user.line_end);
}
RETURN_FALSE;
}
@@ -4146,7 +4146,7 @@ ZEND_METHOD(reflection_class, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(ce);
- RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED);
+ RETURN_INT(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED);
}
/* }}} */
@@ -4657,7 +4657,7 @@ ZEND_METHOD(reflection_class, inNamespace)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
@@ -4680,7 +4680,7 @@ ZEND_METHOD(reflection_class, getNamespaceName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
@@ -4703,10 +4703,10 @@ ZEND_METHOD(reflection_class, getShortName)
RETURN_FALSE;
}
if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name)))
&& backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
+ RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
RETURN_ZVAL(name, 1, 0);
}
@@ -4926,7 +4926,7 @@ ZEND_METHOD(reflection_property, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_LONG(ref->prop.flags);
+ RETURN_INT(ref->prop.flags);
}
/* }}} */
@@ -6058,8 +6058,8 @@ static void _reflection_write_property(zval *object, zval *member, zval *value,
{
if ((Z_TYPE_P(member) == IS_STRING)
&& zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
+ || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member));
@@ -6102,7 +6102,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC);
zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
+ REGISTER_REFLECTION_CLASS_CONST_INT(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6116,12 +6116,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
- REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_STATIC", ZEND_ACC_STATIC);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PUBLIC", ZEND_ACC_PUBLIC);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PROTECTED", ZEND_ACC_PROTECTED);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PRIVATE", ZEND_ACC_PRIVATE);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
+ REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_FINAL", ZEND_ACC_FINAL);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6129,9 +6129,9 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
reflection_register_implement(reflection_class_ptr, reflector_ptr TSRMLS_CC);
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
- REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
- REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
_reflection_entry.create_object = reflection_objects_new;
@@ -6144,10 +6144,10 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
- REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
- REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);
+ REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_STATIC", ZEND_ACC_STATIC);
+ REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
+ REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
+ REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions);
_reflection_entry.create_object = reflection_objects_new;