Browse Source

- Fix mem issue in unicode mode (seems to be a problem in different api behavior)

migration/RELEASE_1_0_0
Marcus Boerger 21 years ago
parent
commit
37f033e0f7
  1. 17
      ext/reflection/php_reflection.c

17
ext/reflection/php_reflection.c

@ -2502,14 +2502,20 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
zval *classname; zval *classname;
reflection_object *intern; reflection_object *intern;
zend_class_entry **ce; zend_class_entry **ce;
char *name;
int name_len;
zend_uchar name_type;
if (is_object) { if (is_object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) {
return; return;
} }
} else { } 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; return;
} }
if (Z_TYPE_P(argument) == IS_OBJECT) {
if (argument) {
MAKE_STD_ZVAL(classname); MAKE_STD_ZVAL(classname);
ZVAL_TEXTL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1); 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); 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); zval_add_ref(&argument);
} }
} else { } 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)) { 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; return;
} }

Loading…
Cancel
Save