From: Marcus Boerger Date: Tue, 21 Feb 2006 00:43:33 +0000 (+0000) Subject: - Fix mem issue in unicode mode (seems to be a problem in different api behavior) X-Git-Tag: RELEASE_1_2~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37f033e0f7aa8b74bee2e6c3e4803144191f9d73;p=php - Fix mem issue in unicode mode (seems to be a problem in different api behavior) --- 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; }