]> granicus.if.org Git - php/commitdiff
- Fix mem issue in unicode mode (seems to be a problem in different api behavior)
authorMarcus Boerger <helly@php.net>
Tue, 21 Feb 2006 00:43:33 +0000 (00:43 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 21 Feb 2006 00:43:33 +0000 (00:43 +0000)
ext/reflection/php_reflection.c

index d7f4d8e4de72af697c9b0a97e3a0eb27d8641954..76a49ed644d101602ed8c452615345c61d36eba2 100644 (file)
@@ -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;
                }