diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-08-17 13:10:04 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-08-17 13:10:04 +0000 |
commit | 48def9a6ad3e372f1e15b022173f3adbce994940 (patch) | |
tree | 57df05c103f86aaa5c0bf620e0d65e148ecaac94 /Zend/zend_reflection_api.c | |
parent | f4ea6b06563b4c298aa404d3b876356303d1f36d (diff) | |
download | php-git-48def9a6ad3e372f1e15b022173f3adbce994940.tar.gz |
Unicode support
Diffstat (limited to 'Zend/zend_reflection_api.c')
-rw-r--r-- | Zend/zend_reflection_api.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index d310f77819..5eae777c02 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -577,13 +577,27 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg } } else if (Z_TYPE_P(zv) == IS_NULL) { string_write(str, "NULL", sizeof("NULL")-1); - } else if (Z_TYPE_P(zv) == IS_STRING) { + } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_BINARY) { + if (Z_TYPE_P(zv) == IS_BINARY) { + string_write(str, "b'", sizeof("b")-1); + } string_write(str, "'", sizeof("'")-1); string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15)); if (Z_STRLEN_P(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); + } else if (Z_TYPE_P(zv) == IS_UNICODE) { + string_write(str, "'", sizeof("'")-1); + zend_make_printable_zval(zv, &zv_copy, &use_copy); + string_write(str, Z_STRVAL(zv_copy), MIN(Z_STRLEN(zv_copy), 15)); + if (Z_STRLEN(zv_copy) > 15) { + string_write(str, "...", sizeof("...")-1); + } + string_write(str, "'", sizeof("'")-1); + if (use_copy) { + zval_dtor(&zv_copy); + } } else { zend_make_printable_zval(zv, &zv_copy, &use_copy); string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); @@ -2420,21 +2434,22 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) char *name; int name_len; zval **prop, *def_value = NULL; + zend_uchar name_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|z", &name, &name_len, &name_type, &def_value) == FAILURE) { return; } GET_REFLECTION_OBJECT_PTR(ce); zend_update_class_constants(ce TSRMLS_CC); - prop = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC); + prop = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC); if (!prop) { if (def_value) { RETURN_ZVAL(def_value, 1, 0); } else { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Class %s does not have a property named %s", ce->name, name); + "Class %v does not have a property named %R", ce->name, name_type, name); } return; } else { @@ -2454,18 +2469,19 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zval **variable_ptr, *value; int refcount; zend_uchar is_ref; + zend_uchar name_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tz", &name, &name_len, &name_type, &value) == FAILURE) { return; } GET_REFLECTION_OBJECT_PTR(ce); zend_update_class_constants(ce TSRMLS_CC); - variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC); + variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC); if (!variable_ptr) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Class %s does not have a property named %s", ce->name, name); + "Class %v does not have a property named %R", ce->name, name_type, name); return; } refcount = (*variable_ptr)->refcount; |