summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2006-02-21 00:43:33 +0000
committerMarcus Boerger <helly@php.net>2006-02-21 00:43:33 +0000
commit37f033e0f7aa8b74bee2e6c3e4803144191f9d73 (patch)
tree73c5d5f09f1e1942bbad99160ddd51e315aa5ee2
parent3ac5297d8b842766070a48a2a21007c58e83b37c (diff)
downloadphp-git-37f033e0f7aa8b74bee2e6c3e4803144191f9d73.tar.gz
- Fix mem issue in unicode mode (seems to be a problem in different api behavior)
-rw-r--r--ext/reflection/php_reflection.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index d7f4d8e4de..76a49ed644 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2502,14 +2502,20 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
zval *classname;
reflection_object *intern;
zend_class_entry **ce;
+ char *name;
+ int name_len;
+ zend_uchar name_type;
if (is_object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &argument) == FAILURE) {
- return;
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) {
+ argument = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &name, &name_len, &name_type) == FAILURE) {
+ return;
+ }
}
}
@@ -2519,7 +2525,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
return;
}
- if (Z_TYPE_P(argument) == IS_OBJECT) {
+ if (argument) {
MAKE_STD_ZVAL(classname);
ZVAL_TEXTL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
@@ -2529,10 +2535,9 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
zval_add_ref(&argument);
}
} else {
- convert_to_string_ex(&argument);
- if (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
+ if (zend_u_lookup_class(name_type, name, name_len, &ce TSRMLS_CC) == FAILURE) {
if (!EG(exception)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument));
+ zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", name_type, name);
}
return;
}