[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
kalle Wed Jul 1 17:42:48 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Fixed memory leak if zero parameters are passed, Thanks Felipe http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.347&r2=1.348&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.347 php-src/ext/reflection/php_reflection.c:1.348 --- php-src/ext/reflection/php_reflection.c:1.347 Wed Jul 1 17:37:42 2009 +++ php-src/ext/reflection/php_reflection.c Wed Jul 1 17:42:48 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.347 2009/07/01 17:37:42 kalle Exp $ */ +/* $Id: php_reflection.c,v 1.348 2009/07/01 17:42:48 kalle Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1800,7 +1800,9 @@ result = zend_call_function(&fci, &fcc TSRMLS_CC); - efree(params); + if (num_args) { + efree(params); + } if (result == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -5687,7 +5689,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.347 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.348 $"); php_info_print_table_end(); } /* }}} */ @@ -5701,7 +5703,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.347 $", + "$Revision: 1.348 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug48757.phpt
kalle Wed Jul 1 17:37:42 2009 UTC Added files: /php-src/ext/reflection/tests bug48757.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: Fixed bug #48757 (ReflectionFunction::invoke() parameter issues) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.346&r2=1.347&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.346 php-src/ext/reflection/php_reflection.c:1.347 --- php-src/ext/reflection/php_reflection.c:1.346 Tue Jun 16 14:29:18 2009 +++ php-src/ext/reflection/php_reflection.c Wed Jul 1 17:37:42 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.346 2009/06/16 14:29:18 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.347 2009/07/01 17:37:42 kalle Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1763,7 +1763,7 @@ } /* }}} */ -/* {{{ proto public mixed ReflectionFunction::invoke(mixed* args) U +/* {{{ proto public mixed ReflectionFunction::invoke([mixed* args]) U Invokes the function */ ZEND_METHOD(reflection_function, invoke) { @@ -1778,7 +1778,7 @@ METHOD_NOTSTATIC(reflection_function_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", ¶ms, &num_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", ¶ms, &num_args) == FAILURE) { return; } @@ -5249,7 +5249,7 @@ ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invoke, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0) ZEND_ARG_INFO(0, args) ZEND_END_ARG_INFO() @@ -5687,7 +5687,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.346 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.347 $"); php_info_print_table_end(); } /* }}} */ @@ -5701,7 +5701,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.346 $", + "$Revision: 1.347 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug48757.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug48757.phpt +++ php-src/ext/reflection/tests/bug48757.phpt --TEST-- Bug #48757 (ReflectionFunction::invoke() parameter issues) --FILE-- invoke(); $func = new ReflectionFunction('another_test'); $func->invoke('testing'); ?> --EXPECT-- Hello World unicode(7) "testing" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c ZendEngine2 zend_stream.h
felipe Tue Jun 16 14:29:19 2009 UTC Modified files: /ZendEngine2zend_stream.h /php-src/ext/reflection php_reflection.c Log: - Fixed build (removed trailing comma) patch by Seiji Masugata http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_stream.h?r1=1.16&r2=1.17&diff_format=u Index: ZendEngine2/zend_stream.h diff -u ZendEngine2/zend_stream.h:1.16 ZendEngine2/zend_stream.h:1.17 --- ZendEngine2/zend_stream.h:1.16 Wed Mar 11 22:11:41 2009 +++ ZendEngine2/zend_stream.h Tue Jun 16 14:29:18 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zend_stream.h,v 1.16 2009/03/11 22:11:41 shire Exp $ */ +/* $Id: zend_stream.h,v 1.17 2009/06/16 14:29:18 felipe Exp $ */ #ifndef ZEND_STREAM_H #define ZEND_STREAM_H @@ -36,7 +36,7 @@ ZEND_HANDLE_FD, ZEND_HANDLE_FP, ZEND_HANDLE_STREAM, - ZEND_HANDLE_MAPPED, + ZEND_HANDLE_MAPPED } zend_stream_type; typedef struct _zend_mmap { http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.345&r2=1.346&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.345 php-src/ext/reflection/php_reflection.c:1.346 --- php-src/ext/reflection/php_reflection.c:1.345 Mon May 25 14:32:14 2009 +++ php-src/ext/reflection/php_reflection.c Tue Jun 16 14:29:18 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.345 2009/05/25 14:32:14 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.346 2009/06/16 14:29:18 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -186,7 +186,7 @@ REF_TYPE_OTHER, /* Must be 0 */ REF_TYPE_FUNCTION, REF_TYPE_PARAMETER, - REF_TYPE_PROPERTY, + REF_TYPE_PROPERTY } reflection_type_t; /* Struct for reflection objects */ @@ -5687,7 +5687,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.345 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.346 $"); php_info_print_table_end(); } /* }}} */ @@ -5701,7 +5701,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.345 $", + "$Revision: 1.346 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug48336.phpt
lbarnaudThu May 21 16:01:22 2009 UTC Added files: /php-src/ext/reflection/tests bug48336.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: Fixed bug #48336 (ReflectionProperty::getDeclaringClass() does not work with redeclared property) (patch by Markus dot Lidel at shadowconnect dot com) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.343&r2=1.344&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.343 php-src/ext/reflection/php_reflection.c:1.344 --- php-src/ext/reflection/php_reflection.c:1.343 Mon Apr 27 19:46:02 2009 +++ php-src/ext/reflection/php_reflection.c Thu May 21 16:01:22 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.343 2009/04/27 19:46:02 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.344 2009/05/21 16:01:22 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4843,6 +4843,10 @@ break; } ce = tmp_ce; + if (tmp_ce == tmp_info->ce) { + /* declared in this class, done */ + break; + } tmp_ce = tmp_ce->parent; } @@ -5683,7 +5687,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.343 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.344 $"); php_info_print_table_end(); } /* }}} */ @@ -5697,7 +5701,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.343 $", + "$Revision: 1.344 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug48336.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug48336.phpt +++ php-src/ext/reflection/tests/bug48336.phpt --TEST-- Bug #48286 (ReflectionProperty::getDeclaringClass() does not work with redeclared properties) --FILE-- '); try { $rp = new ReflectionProperty($class, 'prop'); print($rp->getDeclaringClass()->getName()); } catch(Exception $e) { print('N/A'); } print("\n"); } ?> --EXPECT-- A => N/A B => B C => C D => C E => C F => F -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 002.phpt 008.phpt ReflectionClass_getMethod_001.phpt ReflectionClass_getMethods_001.phpt ReflectionClass_getProperties_00
felipe Mon Apr 27 19:46:03 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests 002.phpt 008.phpt ReflectionClass_getMethod_001.phpt ReflectionClass_getMethods_001.phpt ReflectionClass_getProperties_001.phpt ReflectionClass_getProperty_001.phpt ReflectionClass_getProperty_003.phpt ReflectionClass_getProperty_004.phpt ReflectionMethod_getModifiers_basic.phpt Log: - Fixed bug #47254 (Wrong Reflection for extends class) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.342&r2=1.343&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.342 php-src/ext/reflection/php_reflection.c:1.343 --- php-src/ext/reflection/php_reflection.c:1.342 Sat Apr 4 14:35:28 2009 +++ php-src/ext/reflection/php_reflection.c Mon Apr 27 19:46:02 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.342 2009/04/04 14:35:28 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.343 2009/04/27 19:46:02 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1239,7 +1239,8 @@ MAKE_STD_ZVAL(name); MAKE_STD_ZVAL(classname); ZVAL_TEXT(name, method->common.function_name, 1); - ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); + ZVAL_UNICODEL(classname, method->common.scope->name.u, method->common.scope->name_length, 1); + reflection_instantiate(reflection_method_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = method; @@ -1283,7 +1284,7 @@ MAKE_STD_ZVAL(name); MAKE_STD_ZVAL(classname); ZVAL_TEXT(name, prop_name, 1); - ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); + ZVAL_UNICODEL(classname, prop->ce->name.u, prop->ce->name_length, 1); reflection_instantiate(reflection_property_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); @@ -2542,11 +2543,6 @@ zval_dtor(&ztmp); } - MAKE_STD_ZVAL(classname); - ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - - zend_ascii_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); - lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); if (ce == zend_ce_closure && orig_obj && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2589,18 +2585,25 @@ return; } } - + + MAKE_STD_ZVAL(classname); MAKE_STD_ZVAL(name); + if (intern->obj) { - ZVAL_ZSTRL(name, type, name_str, name_len, 1); + ZVAL_UNICODEL(classname, ce->name.u, ce->name_length, 1); + ZVAL_ZSTRL(name, type, name_str, name_len, 1); } else { + ZVAL_UNICODEL(classname, mptr->common.scope->name.u, mptr->common.scope->name_length, 1); ZVAL_TEXT(name, mptr->common.function_name, 1); } efree(lcname.v); if (free_name_str) { efree(name_str.v); } + + zend_ascii_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); zend_ascii_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL); + intern->ptr = mptr; intern->ref_type = REF_TYPE_FUNCTION; intern->ce = ce; @@ -4525,17 +4528,17 @@ } MAKE_STD_ZVAL(classname); - ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - zend_ascii_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); - - MAKE_STD_ZVAL(propname); + if (dynam_prop == 0) { zend_u_unmangle_property_name(IS_UNICODE, property_info->name, property_info->name_length, &class_name, &prop_name); + ZVAL_UNICODEL(classname, property_info->ce->name.u, property_info->ce->name_length, 1); ZVAL_TEXT(propname, prop_name, 1); } else { + ZVAL_UNICODEL(classname, ce->name.u, ce->name_length, 1); ZVAL_TEXTL(propname, name_str, name_len, 1); } + zend_ascii_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); zend_ascii_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests reflectionProperty_setAccessible.phpt
sebastian Sat Apr 4 14:35:29 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests reflectionProperty_setAccessible.phpt Log: Fix issue reported by Roman Borschel. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.341&r2=1.342&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.341 php-src/ext/reflection/php_reflection.c:1.342 --- php-src/ext/reflection/php_reflection.c:1.341 Thu Mar 26 20:01:57 2009 +++ php-src/ext/reflection/php_reflection.c Sat Apr 4 14:35:28 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.341 2009/03/26 20:01:57 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.342 2009/04/04 14:35:28 sebastian Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4726,7 +4726,7 @@ } zend_u_unmangle_property_name(IS_UNICODE, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); prop_name_len = u_strlen(prop_name.u); - member_p = zend_u_read_property(Z_OBJCE_P(object), object, IS_UNICODE, prop_name, prop_name_len, 1 TSRMLS_CC); + member_p = zend_u_read_property(ref->ce, object, IS_UNICODE, prop_name, prop_name_len, 1 TSRMLS_CC); *return_value= *member_p; zval_copy_ctor(return_value); INIT_PZVAL(return_value); @@ -4807,7 +4807,7 @@ } zend_u_unmangle_property_name(IS_UNICODE, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); prop_name_len = u_strlen(prop_name.u); - zend_u_update_property(Z_OBJCE_P(object), object, IS_UNICODE, prop_name, prop_name_len, value TSRMLS_CC); + zend_u_update_property(ref->ce, object, IS_UNICODE, prop_name, prop_name_len, value TSRMLS_CC); } } /* }}} */ @@ -5680,7 +5680,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.341 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.342 $"); php_info_print_table_end(); } /* }}} */ @@ -5694,7 +5694,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.341 $", + "$Revision: 1.342 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt diff -u php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.3 php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.4 --- php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.3 Sat Nov 29 15:58:30 2008 +++ php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt Sat Apr 4 14:35:28 2009 @@ -9,6 +9,8 @@ private static $privateStatic = 'd'; } +class B extends A {} + $a = new A; $protected = new ReflectionProperty($a, 'protected'); $protectedStatic = new ReflectionProperty('A', 'protectedStatic'); @@ -66,6 +68,52 @@ var_dump($protectedStatic->getValue()); var_dump($private->getValue($a)); var_dump($privateStatic->getValue()); + +$a = new A; +$b = new B; +$protected = new ReflectionProperty($b, 'protected'); +$protectedStatic = new ReflectionProperty('B', 'protectedStatic'); +$private = new ReflectionProperty($a, 'private'); + +try { +var_dump($protected->getValue($b)); +} + +catch (ReflectionException $e) { +var_dump($e->getMessage()); +} + +try { +var_dump($protectedStatic->getValue()); +} + +catch (ReflectionException $e) { +var_dump($e->getMessage()); +} + +try { +var_dump($private->getValue($b)); +} + +catch (ReflectionException $e) { +var_dump($e->getMessage()); +} + +$protected->setAccessible(TRUE); +$protectedStatic->setAccessible(TRUE); +$private->setAccessible(TRUE); + +var_dump($protected->getValue($b)); +var_dump($protectedStatic->getValue()); +var_dump($private->getValue($b)); + +$protected->setValue($b, 'e'); +$protectedStatic->setValue('f'); +$private->setValue($b, 'g'); + +var_dump($protected->getValue($b)); +var_dump($protectedStatic->getValue()); +var_dump($private->getValue($b)); ?> --EXPECT-- unicode(44) "Cannot access non-public member A::protected" @@ -80,3 +128,12 @@ unicode(1) "f" unicode(1) "g" unicode(1) "h" +unicode(44) "Cannot access non-public member B::protected" +unicode(50) "Cannot access non-public member B::protectedStatic" +unicode(42) "Cannot access non-public member A::private" +unicode(1) "a" +unicode(1) "f" +unicode(1) "c" +unicode(1) "e" +unicode(1) "f" +unicode(1) "g" -- PHP CVS Mailing List (http://www.php.n
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 21:06:39 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - MFB Missing namespace changes # Now all tests PASS again http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.337&r2=1.338&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.337 php-src/ext/reflection/php_reflection.c:1.338 --- php-src/ext/reflection/php_reflection.c:1.337 Sat Jan 3 20:40:22 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 21:06:38 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.337 2009/01/03 20:40:22 helly Exp $ */ +/* $Id: php_reflection.c,v 1.338 2009/01/03 21:06:38 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2899,13 +2899,13 @@ RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) - && colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') + && (colon.s = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && colon.s > Z_STRVAL_PP(name)) { RETURN_TRUE; } else if (Z_TYPE_PP(name) == IS_UNICODE - && (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) - && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') + && (colon.u = u_memrchr(Z_USTRVAL_PP(name), '\\', Z_USTRLEN_PP(name))) + && colon.u > Z_USTRVAL_PP(name)) { RETURN_TRUE; } @@ -2913,53 +2913,53 @@ } /* }}} */ -/* {{{ proto public string ReflectionFunction::getNamespaceName() +/* {{{ proto public string ReflectionFunction::getNamespaceName() U Returns the name of namespace where this function is defined */ ZEND_METHOD(reflection_function, getNamespaceName) { zval **name; - zstr colon; + zstr backslash; METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) - && colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') + && (backslash.s = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && backslash.s > Z_STRVAL_PP(name)) { - RETURN_STRINGL(Z_STRVAL_PP(name), colon.s - Z_STRVAL_PP(name) - 1, 1); + RETURN_STRINGL(Z_STRVAL_PP(name), backslash.s - Z_STRVAL_PP(name), 1); } else if (Z_TYPE_PP(name) == IS_UNICODE - && (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) - && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') + && (backslash.u = u_memrchr(Z_USTRVAL_PP(name), '\\', Z_USTRLEN_PP(name))) + && backslash.u > Z_USTRVAL_PP(name)) { - RETURN_UNICODEL(Z_USTRVAL_PP(name), colon.u - Z_USTRVAL_PP(name) - 1, 1); + RETURN_UNICODEL(Z_USTRVAL_PP(name), backslash.u - Z_USTRVAL_PP(name), 1); } RETURN_EMPTY_TEXT(); } /* }}} */ -/* {{{ proto public string ReflectionFunction::getShortName() +/* {{{ proto public string ReflectionFunction::getShortName() U Returns the short name of the function (without namespace part) */ ZEND_METHOD(reflection_function, getShortName) { zval **name; - zstr colon; + zstr backslash; METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) - && colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') + && (backslash.s = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && backslash.s > Z_STRVAL_PP(name)) { - RETURN_STRINGL(colon.s + 1, Z_STRLEN_PP(name) - (colon.s - Z_STRVAL_PP(name) + 1), 1); + RETURN_STRINGL(backslash.s + 1, Z_STRLEN_PP(name) - (backslash.s - Z_STRVAL_PP(name) + 1), 1); } else if (Z_TYPE_PP(name) == IS_UNICODE - && (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) - && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') + && (backslash.u = u_memrchr(Z_USTRVAL_PP(name), '\\', Z_USTRLEN_PP(name))) + && backslash.u > Z_USTRVAL_PP(name)) { - RETURN_UNICODEL(colon.u + 1, Z_USTRLEN_PP(name) - (colon.u - Z_USTRV
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 027.phpt ReflectionMethod_getClosure_error.phpt
helly Sat Jan 3 20:40:22 2009 UTC Added files: /php-src/ext/reflection/tests 027.phpt Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests ReflectionMethod_getClosure_error.phpt Log: - Minor corrections and a new test http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.336&r2=1.337&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.336 php-src/ext/reflection/php_reflection.c:1.337 --- php-src/ext/reflection/php_reflection.c:1.336 Sat Jan 3 20:03:45 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 20:40:22 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.336 2009/01/03 20:03:45 helly Exp $ */ +/* $Id: php_reflection.c,v 1.337 2009/01/03 20:40:22 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -886,7 +886,7 @@ string_printf(str, "\n"); string_printf(str, "%s - Static Parameters [%d] {\n", indent, count); if (closure_this) { - string_printf(str, "%sParameter #%d [ %v $this ]\n", indent, ++index, Z_OBJCE_P(closure_this)->name); + string_printf(str, "%sParameter #%d [ %v $this ]\n", indent, index++, Z_OBJCE_P(closure_this)->name); } if (static_variables) { HashPosition pos; @@ -894,7 +894,7 @@ zstr key; ulong num_index; zend_hash_internal_pointer_reset_ex(static_variables, &pos); - while (index++ < count) { + while (index < count) { zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, &pos); string_printf(str, "%sParameter #%d [ $%v ]\n", indent, index++, key); zend_hash_move_forward_ex(static_variables, &pos); @@ -1605,7 +1605,9 @@ GET_REFLECTION_OBJECT_PTR(fptr); if (intern->obj) { closure_this = zend_get_closure_this_ptr(intern->obj TSRMLS_CC); - RETURN_ZVAL(closure_this, 1, 0); + if (closure_this) { + RETURN_ZVAL(closure_this, 1, 0); + } } } /* }}} */ @@ -5558,7 +5560,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.336 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.337 $"); php_info_print_table_end(); } /* }}} */ @@ -5572,7 +5574,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.336 $", + "$Revision: 1.337 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt diff -u php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.2 php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.3 --- php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.2 Fri Aug 8 12:42:40 2008 +++ php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt Sat Jan 3 20:40:22 2009 @@ -56,9 +56,13 @@ *** Testing ReflectionMethod::getClosure() : error conditions *** -- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments -- -object(Closure)#%d (0) { +object(Closure)#%d (1) { + ["this"]=> + NULL } -object(Closure)#%d (0) { +object(Closure)#%d (1) { + ["this"]=> + NULL } Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/027.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/027.phpt +++ php-src/ext/reflection/tests/027.phpt --TEST-- --FILE-- getClosureThis())); var_dump($r->getName()); var_dump($r->isClosure()); Class Test { public $func; function __construct(){ global $global; $this->func = function($x, stdClass $y = NULL) use($global) { static $static; }; } } ReflectionMethod::export(new Test, "func"); $r = new ReflectionMethod(new Test, "func"); var_dump(get_class($r->getClosureThis())); var_dump($r->getName()); var_dump($r->isClosure()); ?> ===DONE=== --EXPECTF-- Closure [ function {closure} ] { @@ %s027.php 5 - 7 - Static Paramet
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 20:03:45 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Show closure's bound as static parameter http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.335&r2=1.336&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.335 php-src/ext/reflection/php_reflection.c:1.336 --- php-src/ext/reflection/php_reflection.c:1.335 Sat Jan 3 19:08:27 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 20:03:45 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.335 2009/01/03 19:08:27 helly Exp $ */ +/* $Id: php_reflection.c,v 1.336 2009/01/03 20:03:45 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -875,24 +875,32 @@ } if (closure) { const zend_function *closure_fptr = zend_get_closure_method_def(closure TSRMLS_CC); + zval *closure_this = zend_get_closure_this_ptr(closure TSRMLS_CC); + HashTable *static_variables = NULL; + int index = 0, count = closure_this ? 1 : 0; if (closure_fptr->type == ZEND_USER_FUNCTION && closure_fptr->op_array.static_variables) { - HashTable *static_variables = closure_fptr->op_array.static_variables; - HashPosition pos; - uint key_len; - zstr key; - ulong num_index, index = 0; - int count = zend_hash_num_elements(static_variables); - if (count) { - string_printf(str, "\n"); - string_printf(str, "%s - Static Parameters [%d] {\n", indent, count); + static_variables = closure_fptr->op_array.static_variables; + count += zend_hash_num_elements(static_variables); + } + if (count) { + string_printf(str, "\n"); + string_printf(str, "%s - Static Parameters [%d] {\n", indent, count); + if (closure_this) { + string_printf(str, "%sParameter #%d [ %v $this ]\n", indent, ++index, Z_OBJCE_P(closure_this)->name); + } + if (static_variables) { + HashPosition pos; + uint key_len; + zstr key; + ulong num_index; zend_hash_internal_pointer_reset_ex(static_variables, &pos); while (index++ < count) { zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, &pos); string_printf(str, "%sParameter #%d [ $%v ]\n", indent, index++, key); zend_hash_move_forward_ex(static_variables, &pos); - } - string_printf(str, "%s }\n", indent); + } } + string_printf(str, "%s }\n", indent); } } string_init(¶m_indent); @@ -5550,7 +5558,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.335 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.336 $"); php_info_print_table_end(); } /* }}} */ @@ -5564,7 +5572,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.335 $", + "$Revision: 1.336 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 19:08:27 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Return this pointer and not closure itself http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.334&r2=1.335&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.334 php-src/ext/reflection/php_reflection.c:1.335 --- php-src/ext/reflection/php_reflection.c:1.334 Sat Jan 3 19:02:06 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 19:08:27 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.334 2009/01/03 19:02:06 helly Exp $ */ +/* $Id: php_reflection.c,v 1.335 2009/01/03 19:08:27 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1591,10 +1591,14 @@ { reflection_object *intern; zend_function *fptr; + zval* closure_this; METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_ZVAL(intern->obj, 1, 0); + if (intern->obj) { + closure_this = zend_get_closure_this_ptr(intern->obj TSRMLS_CC); + RETURN_ZVAL(closure_this, 1, 0); + } } /* }}} */ @@ -5546,7 +5550,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.334 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.335 $"); php_info_print_table_end(); } /* }}} */ @@ -5560,7 +5564,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.334 $", + "$Revision: 1.335 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 19:02:07 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Add ReflectionFunctionAbstract::getClosureThis() http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.333&r2=1.334&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.333 php-src/ext/reflection/php_reflection.c:1.334 --- php-src/ext/reflection/php_reflection.c:1.333 Sat Jan 3 14:20:07 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 19:02:06 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.333 2009/01/03 14:20:07 helly Exp $ */ +/* $Id: php_reflection.c,v 1.334 2009/01/03 19:02:06 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1585,6 +1585,19 @@ } /* }}} */ +/* {{{ proto public bool ReflectionFunction::getClosureThis() U + Returns this pointer bound to closure */ +ZEND_METHOD(reflection_function, getClosureThis) +{ + reflection_object *intern; + zend_function *fptr; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); + GET_REFLECTION_OBJECT_PTR(fptr); + RETURN_ZVAL(intern->obj, 1, 0); +} +/* }}} */ + /* {{{ proto public bool ReflectionFunction::isInternal() U Returns whether this is an internal function */ ZEND_METHOD(reflection_function, isInternal) @@ -5106,25 +5119,26 @@ static const zend_function_entry reflection_function_abstract_functions[] = { ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) PHP_ABSTRACT_ME(reflection_function, __toString, NULL) + ZEND_ME(reflection_function, inNamespace, NULL, 0) ZEND_ME(reflection_function, isClosure, NULL, 0) + ZEND_ME(reflection_function, isDeprecated, NULL, 0) ZEND_ME(reflection_function, isInternal, NULL, 0) ZEND_ME(reflection_function, isUserDefined, NULL, 0) - ZEND_ME(reflection_function, getName, NULL, 0) - ZEND_ME(reflection_function, getFileName, NULL, 0) - ZEND_ME(reflection_function, getStartLine, NULL, 0) - ZEND_ME(reflection_function, getEndLine, NULL, 0) + ZEND_ME(reflection_function, getClosureThis, NULL, 0) ZEND_ME(reflection_function, getDocComment, NULL, 0) - ZEND_ME(reflection_function, getStaticVariables, NULL, 0) - ZEND_ME(reflection_function, returnsReference, NULL, 0) - ZEND_ME(reflection_function, getParameters, NULL, 0) - ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0) - ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0) + ZEND_ME(reflection_function, getEndLine, NULL, 0) ZEND_ME(reflection_function, getExtension, NULL, 0) ZEND_ME(reflection_function, getExtensionName, NULL, 0) - ZEND_ME(reflection_function, isDeprecated, NULL, 0) - ZEND_ME(reflection_function, inNamespace, NULL, 0) + ZEND_ME(reflection_function, getFileName, NULL, 0) + ZEND_ME(reflection_function, getName, NULL, 0) ZEND_ME(reflection_function, getNamespaceName, NULL, 0) + ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0) + ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0) + ZEND_ME(reflection_function, getParameters, NULL, 0) ZEND_ME(reflection_function, getShortName, NULL, 0) + ZEND_ME(reflection_function, getStartLine, NULL, 0) + ZEND_ME(reflection_function, getStaticVariables, NULL, 0) + ZEND_ME(reflection_function, returnsReference, NULL, 0) {NULL, NULL, NULL} }; @@ -5532,7 +5546,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.333 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.334 $"); php_info_print_table_end(); } /* }}} */ @@ -5546,7 +5560,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.333 $", + "$Revision: 1.334 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 14:20:07 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Improved closure support http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.332&r2=1.333&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.332 php-src/ext/reflection/php_reflection.c:1.333 --- php-src/ext/reflection/php_reflection.c:1.332 Sat Jan 3 12:27:43 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 14:20:07 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.332 2009/01/03 12:27:43 helly Exp $ */ +/* $Id: php_reflection.c,v 1.333 2009/01/03 14:20:07 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -219,6 +219,18 @@ } /* }}} */ +static void _default_lookup_entry(zval *object, char *name, int name_len, zval **return_value TSRMLS_DC) /* {{{ */ +{ + zval **value; + + if (zend_ascii_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) { + *return_value = NULL; + } else { + *return_value = *value; + } +} +/* }}} */ + static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC) /* {{{ */ { zend_uint num_interfaces = ++class_entry->num_interfaces; @@ -323,7 +335,7 @@ /* }}} */ static void _const_string(string *str, zstr name, zval *value, char *indent TSRMLS_DC); -static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* closure, char *indent TSRMLS_DC); +static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* prop_name, zval* closure, char *indent TSRMLS_DC); static void _property_string(string *str, zend_property_info *prop, zstr prop_name, char* indent TSRMLS_DC); static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *indent TSRMLS_DC); static void _extension_string(string *str, zend_module_entry *module, char *indent TSRMLS_DC); @@ -489,7 +501,7 @@ && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { string_printf(str, "\n"); - _function_string(str, mptr, ce, NULL, sub_indent.string TSRMLS_CC); + _function_string(str, mptr, ce, NULL, NULL, sub_indent.string TSRMLS_CC); } zend_hash_move_forward_ex(&ce->function_table, &pos); } @@ -595,7 +607,7 @@ } string_printf(&dyn, "\n"); - _function_string(&dyn, mptr, ce, NULL, sub_indent.string TSRMLS_CC); + _function_string(&dyn, mptr, ce, NULL, NULL, sub_indent.string TSRMLS_CC); count++; _free_function(closure TSRMLS_CC); } @@ -767,7 +779,7 @@ /* }}} */ /* {{{ _function_string */ -static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* closure, char* indent TSRMLS_DC) +static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* prop_name, zval* closure, char* indent TSRMLS_DC) { string param_indent; zend_function *overwrites; @@ -849,7 +861,11 @@ if (fptr->op_array.return_reference) { string_printf(str, "&"); } - string_printf(str, "%v ] {\n", fptr->common.function_name); + if (closure && prop_name) { + string_printf(str, "%R ] {\n", Z_TYPE_P(prop_name), Z_UNIVAL_P(prop_name)); + } else { + string_printf(str, "%v ] {\n", fptr->common.function_name); + } /* The information where a function is declared is only available for user classes */ if (fptr->type == ZEND_USER_FUNCTION) { string_printf(str, "%s @@ %s %d - %d\n", indent, @@ -1085,7 +1101,7 @@ continue; } - _function_string(str, fptr, NULL, NULL, "" TSRMLS_CC); + _function_string(str, fptr, NULL, NULL, NULL, "" TSRMLS_CC); func++; } string_printf(str, "%s }\n", indent); @@ -1504,7 +1520,7 @@ } if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &closure, zend_ce_closure) == SUCCESS) { - fptr = zend_get_closure_invoke_met
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 12:27:44 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Small reordering http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.331&r2=1.332&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.331 php-src/ext/reflection/php_reflection.c:1.332 --- php-src/ext/reflection/php_reflection.c:1.331 Sat Jan 3 12:20:27 2009 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 12:27:43 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.331 2009/01/03 12:20:27 helly Exp $ */ +/* $Id: php_reflection.c,v 1.332 2009/01/03 12:27:43 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -857,8 +857,6 @@ fptr->op_array.line_start, fptr->op_array.line_end); } - string_init(¶m_indent); - string_printf(¶m_indent, "%s ", indent); if (closure) { const zend_function *closure_fptr = zend_get_closure_method_def(closure TSRMLS_CC); if (closure_fptr->type == ZEND_USER_FUNCTION && closure_fptr->op_array.static_variables) { @@ -881,6 +879,8 @@ } } } + string_init(¶m_indent); + string_printf(¶m_indent, "%s ", indent); _function_parameter_string(str, fptr, param_indent.string TSRMLS_CC); string_free(¶m_indent); string_printf(str, "%s}\n", indent); @@ -5482,7 +5482,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Revision: 1.331 $"); + php_info_print_table_row(2, "Version", "$Revision: 1.332 $"); php_info_print_table_end(); } /* }}} */ @@ -5496,7 +5496,7 @@ NULL, NULL, PHP_MINFO(reflection), - "$Revision: 1.331 $", + "$Revision: 1.332 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jan 3 12:20:27 2009 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Add minimalistic closure support http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.330&r2=1.331&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.330 php-src/ext/reflection/php_reflection.c:1.331 --- php-src/ext/reflection/php_reflection.c:1.330 Wed Dec 31 14:37:17 2008 +++ php-src/ext/reflection/php_reflection.c Sat Jan 3 12:20:27 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.330 2008/12/31 14:37:17 helly Exp $ */ +/* $Id: php_reflection.c,v 1.331 2009/01/03 12:20:27 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -323,7 +323,7 @@ /* }}} */ static void _const_string(string *str, zstr name, zval *value, char *indent TSRMLS_DC); -static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char *indent TSRMLS_DC); +static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* closure, char *indent TSRMLS_DC); static void _property_string(string *str, zend_property_info *prop, zstr prop_name, char* indent TSRMLS_DC); static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *indent TSRMLS_DC); static void _extension_string(string *str, zend_module_entry *module, char *indent TSRMLS_DC); @@ -489,7 +489,7 @@ && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { string_printf(str, "\n"); - _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); + _function_string(str, mptr, ce, NULL, sub_indent.string TSRMLS_CC); } zend_hash_move_forward_ex(&ce->function_table, &pos); } @@ -595,7 +595,7 @@ } string_printf(&dyn, "\n"); - _function_string(&dyn, mptr, ce, sub_indent.string TSRMLS_CC); + _function_string(&dyn, mptr, ce, NULL, sub_indent.string TSRMLS_CC); count++; _free_function(closure TSRMLS_CC); } @@ -767,7 +767,7 @@ /* }}} */ /* {{{ _function_string */ -static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char* indent TSRMLS_DC) +static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, zval* closure, char* indent TSRMLS_DC) { string param_indent; zend_function *overwrites; @@ -782,7 +782,8 @@ string_printf(str, "%s%v\n", indent, fptr->op_array.doc_comment.v); } - string_printf(str, fptr->common.scope ? "%sMethod [ " : "%sFunction [ ", indent); + string_write(str, indent, strlen(indent)); + string_printf(str, closure ? "Closure [ " : (fptr->common.scope ? "Method [ " : "Function [ ")); string_printf(str, (fptr->type == ZEND_USER_FUNCTION) ? "common.fn_flags & ZEND_ACC_DEPRECATED) { string_printf(str, ", deprecated"); @@ -858,6 +859,28 @@ } string_init(¶m_indent); string_printf(¶m_indent, "%s ", indent); + if (closure) { + const zend_function *closure_fptr = zend_get_closure_method_def(closure TSRMLS_CC); + if (closure_fptr->type == ZEND_USER_FUNCTION && closure_fptr->op_array.static_variables) { + HashTable *static_variables = closure_fptr->op_array.static_variables; + HashPosition pos; + uint key_len; + zstr key; + ulong num_index, index = 0; + int count = zend_hash_num_elements(static_variables); + if (count) { + string_printf(str, "\n"); + string_printf(str, "%s - Static Parameters [%d] {\n", indent, count); + zend_hash_internal_pointer_reset_ex(static_variables, &pos); + while (index++ < count) { + zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, &pos); + string_printf(str, "%sParameter #%d [ $%v ]\n", indent, index++, key); + zend_hash_move_forward_ex(static_variables, &pos); + }
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Wed Dec 31 14:37:17 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - MFB Use Revision instead of Id tag for version http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.329&r2=1.330&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.329 php-src/ext/reflection/php_reflection.c:1.330 --- php-src/ext/reflection/php_reflection.c:1.329 Wed Dec 31 11:12:35 2008 +++ php-src/ext/reflection/php_reflection.c Wed Dec 31 14:37:17 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.329 2008/12/31 11:12:35 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.330 2008/12/31 14:37:17 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -5438,7 +5438,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.329 2008/12/31 11:12:35 sebastian Exp $"); + php_info_print_table_row(2, "Version", "$Revision: 1.330 $"); php_info_print_table_end(); } /* }}} */ @@ -5452,7 +5452,7 @@ NULL, NULL, PHP_MINFO(reflection), - "0.1", + "$Revision: 1.330 $", STANDARD_MODULE_PROPERTIES }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests reflectionProperty_setAccessible.phpt
sebastian Sat Nov 29 15:58:30 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests reflectionProperty_setAccessible.phpt Log: Fix #46718: ReflectionProperty::setValue() and ReflectionProperty::setAccessible(). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.327&r2=1.328&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.327 php-src/ext/reflection/php_reflection.c:1.328 --- php-src/ext/reflection/php_reflection.c:1.327 Thu Nov 27 19:02:45 2008 +++ php-src/ext/reflection/php_reflection.c Sat Nov 29 15:58:29 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.327 2008/11/27 19:02:45 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.328 2008/11/29 15:58:29 sebastian Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4537,7 +4537,7 @@ METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop.flags & ZEND_ACC_PUBLIC)) { + if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && ref->ignore_visibility == 0) { _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot access non-public member %v::%v", intern->ce->name, Z_UNIVAL(name)); @@ -4581,10 +4581,15 @@ zend_u_hash_quick_update(prop_table, utype, ref->prop.name, ref->prop.name_length+1, ref->prop.h, &value, sizeof(zval *), (void **) &foo); } } else { + zstr class_name, prop_name; + int prop_name_len; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) { return; } - zend_u_update_property(Z_OBJCE_P(object), object, UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, value TSRMLS_CC); + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); + prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + zend_u_update_property(Z_OBJCE_P(object), object, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value TSRMLS_CC); } } /* }}} */ @@ -5433,7 +5438,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.327 2008/11/27 19:02:45 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.328 2008/11/29 15:58:29 sebastian Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt diff -u php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.2 php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.3 --- php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.2 Sat May 24 13:35:03 2008 +++ php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt Sat Nov 29 15:58:30 2008 @@ -2,43 +2,81 @@ Test ReflectionProperty::setAccessible(). --FILE-- getValue($a)); } -$instance = new TestClass(); +catch (ReflectionException $e) { +var_dump($e->getMessage()); +} -echo "\nProtected property:\n"; -$propInfo = new ReflectionProperty('TestClass', 'prot'); try { -var_dump($propInfo->getValue($instance)); +var_dump($protectedStatic->getValue()); } -catch(Exception $exc) { -echo $exc->getMessage(), "\n"; + +catch (ReflectionException $e) { +var_dump($e->getMessage()); } -$propInfo->setAccessible(true); -var_dump($propInfo->getValue($instance)); +try { +var_dump($private->getValue($a)); +} + +catch (ReflectionException $e) { +var_dump($e->getMessage()); +} -$propInfo->setAccessible(false); try { -var_dump($propInfo->getValue($instance)); +var_dump($privateStatic->getValue()); } -catch(Exception $exc) { -echo $exc->getMessage(), "\n"; + +catch (ReflectionException $e) { +var_dump($e->getMessage()); } -?> ---EXPECTF-- -Protected property: -Cannot access non-public member TestClass::prot -int(4) -Cannot access non-public member TestClass::prot +$protected->setAccessible(TRUE); +$protectedStatic->setAccessible(TRUE); +$private->setAccessible(TRUE); +$privateStatic->setAccessible(TRUE); + +var_dump($protected->getValue($a)); +var_dump($protectedStatic->getValue()); +var_dump($private->getValue($a)); +var_dump($privateStatic->getValue()); + +$protected->setValue($a, 'e'); +$protectedSt
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
felipe Fri Nov 21 23:32:50 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed bug #46604 (ReflectionClass::getProperty() fails) [only in this branch] http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.325&r2=1.326&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.325 php-src/ext/reflection/php_reflection.c:1.326 --- php-src/ext/reflection/php_reflection.c:1.325 Mon Nov 17 11:26:23 2008 +++ php-src/ext/reflection/php_reflection.c Fri Nov 21 23:32:50 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.325 2008/11/17 11:26:23 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.326 2008/11/21 23:32:50 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3488,8 +3488,8 @@ if (zend_u_hash_find(&ce->properties_info, name_type, name, name_len + 1, (void**) &property_info) == SUCCESS) { if ((property_info->flags & ZEND_ACC_SHADOW) == 0) { reflection_property_factory(ce, property_info, return_value TSRMLS_CC); + return; } - return; } else if (intern->obj) { /* Check for dynamic properties */ if (zend_u_hash_exists(Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC), name_type, name, name_len+1)) { @@ -5433,7 +5433,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.325 2008/11/17 11:26:23 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.326 2008/11/21 23:32:50 felipe Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Fri Nov 14 19:22:09 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Interfaces extend other interfaces, not implement http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.323&r2=1.324&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.323 php-src/ext/reflection/php_reflection.c:1.324 --- php-src/ext/reflection/php_reflection.c:1.323 Sun Nov 2 21:10:10 2008 +++ php-src/ext/reflection/php_reflection.c Fri Nov 14 19:22:09 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.323 2008/11/02 21:10:10 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.324 2008/11/14 19:22:09 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -375,7 +375,11 @@ if (ce->num_interfaces) { zend_uint i; - string_printf(str, " implements %v", ce->interfaces[0]->name); + if (ce->ce_flags & ZEND_ACC_INTERFACE) { + string_printf(str, " extends %v", ce->interfaces[0]->name); + } else { + string_printf(str, " implements %v", ce->interfaces[0]->name); + } for (i = 1; i < ce->num_interfaces; ++i) { string_printf(str, ", %v", ce->interfaces[i]->name); } @@ -5467,7 +5471,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.323 2008/11/02 21:10:10 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.324 2008/11/14 19:22:09 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
felipe Wed Oct 29 13:01:44 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed char formatter http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.321&r2=1.322&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.321 php-src/ext/reflection/php_reflection.c:1.322 --- php-src/ext/reflection/php_reflection.c:1.321 Wed Oct 29 12:41:22 2008 +++ php-src/ext/reflection/php_reflection.c Wed Oct 29 13:01:44 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.321 2008/10/29 12:41:22 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.322 2008/10/29 13:01:44 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4295,7 +4295,7 @@ } } if (dynam_prop == 0) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %s::$%v does not exist", ce->name, name_str); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %v::$%v does not exist", ce->name, name_str); return; } } @@ -5429,7 +5429,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.321 2008/10/29 12:41:22 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.322 2008/10/29 13:01:44 felipe Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug46064.phpt bug46064_2.phpt
felipe Wed Oct 29 12:41:22 2008 UTC Added files: /php-src/ext/reflection/tests bug46064.phpt bug46064_2.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed bug #46064 (Exception when creating ReflectionProperty object on dynamicly created property) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.320&r2=1.321&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.320 php-src/ext/reflection/php_reflection.c:1.321 --- php-src/ext/reflection/php_reflection.c:1.320 Fri Oct 24 14:34:15 2008 +++ php-src/ext/reflection/php_reflection.c Wed Oct 29 12:41:22 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.320 2008/10/24 14:34:15 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.321 2008/10/29 12:41:22 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1424,6 +1424,9 @@ if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) { add_next_index_ascii_stringl(return_value, "final", sizeof("final")-1, 1); } + if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) { + add_next_index_ascii_stringl(return_value, "public", sizeof("public")-1, 1); + } /* These are mutually exclusive */ switch (modifiers & ZEND_ACC_PPP_MASK) { @@ -3468,7 +3471,8 @@ zend_property_info *property_info; zstr name, classname; zstr tmp; - int name_len, classname_len, tmp_len; + int name_len, classname_len; + unsigned int tmp_len; zend_uchar name_type; METHOD_NOTSTATIC(reflection_class_ptr); @@ -3482,6 +3486,20 @@ reflection_property_factory(ce, property_info, return_value TSRMLS_CC); } return; + } else if (intern->obj) { + /* Check for dynamic properties */ + if (zend_u_hash_exists(Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC), name_type, name, name_len+1)) { + zend_property_info property_info_tmp; + property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC; + property_info_tmp.name = name; + property_info_tmp.name_length = name_len; + property_info_tmp.h = zend_u_get_hash_value(name_type, name, name_len+1); + property_info_tmp.doc_comment = NULL_ZSTR; + property_info_tmp.ce = ce; + + reflection_property_factory(ce, &property_info_tmp, return_value TSRMLS_CC); + return; + } } if ((name_type == IS_UNICODE && (tmp.u = u_strstr(name.u, u_doublecolon)) != NULL) || (name_type == IS_STRING && (tmp.s = strstr(name.s, "::")) != NULL)) @@ -4229,12 +4247,12 @@ { zval *propname, *classname; zstr name_str, class_name, prop_name; - int name_len; + int name_len, dynam_prop = 0; zval *object; reflection_object *intern; zend_class_entry **pce; zend_class_entry *ce; - zend_property_info *property_info; + zend_property_info *property_info = NULL; property_reference *reference; zend_uchar name_type; @@ -4270,12 +4288,19 @@ } if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Property %v::$%R does not exist", ce->name, name_type, name_str); - return; + /* Check for dynamic properties */ + if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT && Z_OBJ_HT_P(classname)->get_properties) { + if (zend_u_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname TSRMLS_CC), name_type, name_str, name_len+1)) { + dynam_prop = 1; + } + } + if (dynam_prop == 0) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %s::$%v does not exist", ce->name, name_str); + return; + } } - if (!(property_info->flags & ZEND_ACC_PRIVATE)) { + if (dynam_prop == 0 && !(property_info->flags & ZEND_ACC_PRIVATE)) { /* we have to search the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce; zend_property_info *tmp_info; @@ -4291,14 +4316,28 @@ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); zend_ascii_hash_update(Z_OBJPROP_P(object), "class", siz
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug46205.phpt
dmitry Wed Oct 1 07:30:52 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug46205.phpt Log: Fixed bug #46205 (Closure - Memory leaks when ReflectionException is thrown) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.318&r2=1.319&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.318 php-src/ext/reflection/php_reflection.c:1.319 --- php-src/ext/reflection/php_reflection.c:1.318 Fri Aug 22 15:51:50 2008 +++ php-src/ext/reflection/php_reflection.c Wed Oct 1 07:30:52 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.318 2008/08/22 15:51:50 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.319 2008/10/01 07:30:52 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2005,6 +2005,12 @@ if (Z_TYPE_PP(parameter) == IS_LONG) { position= Z_LVAL_PP(parameter); if (position < 0 || (zend_uint)position >= fptr->common.num_args) { + if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { + if (fptr->type != ZEND_OVERLOADED_FUNCTION) { + efree(fptr->common.function_name.v); + } + efree(fptr); + } _DO_THROW("The parameter specified by its offset could not be found"); /* returns out of this function */ } @@ -2023,6 +2029,12 @@ } } if (position == -1) { + if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { + if (fptr->type != ZEND_OVERLOADED_FUNCTION) { + efree(fptr->common.function_name.v); + } + efree(fptr); + } _DO_THROW("The parameter specified by its name could not be found"); /* returns out of this function */ } @@ -5416,7 +5428,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.318 2008/08/22 15:51:50 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.319 2008/10/01 07:30:52 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug46205.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug46205.phpt diff -u /dev/null php-src/ext/reflection/tests/bug46205.phpt:1.2 --- /dev/null Wed Oct 1 07:30:52 2008 +++ php-src/ext/reflection/tests/bug46205.phpt Wed Oct 1 07:30:52 2008 @@ -0,0 +1,14 @@ +--TEST-- +Bug #46205 (Closure - Memory leaks when ReflectionException is thrown) +--FILE-- +invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1)); +} catch (Exception $e) { } +?> +ok +--EXPECT-- +ok -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/standard basic_functions.c ZendEngine2 zend_compile.c
felipe Fri Aug 22 15:51:51 2008 UTC Modified files: /ZendEngine2zend_compile.c /php-src/ext/standard basic_functions.c /php-src/ext/reflection php_reflection.c Log: - Removed unused arguments http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.837&r2=1.838&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.837 ZendEngine2/zend_compile.c:1.838 --- ZendEngine2/zend_compile.c:1.837Tue Aug 12 17:15:59 2008 +++ ZendEngine2/zend_compile.c Fri Aug 22 15:51:50 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_compile.c,v 1.837 2008/08/12 17:15:59 felipe Exp $ */ +/* $Id: zend_compile.c,v 1.838 2008/08/22 15:51:50 felipe Exp $ */ #include #include "zend.h" @@ -2898,7 +2898,7 @@ zend_update_class_constants(parent_ce TSRMLS_CC); zend_hash_apply_with_arguments(CE_STATIC_MEMBERS(parent_ce) TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members); } else { - zend_hash_apply_with_arguments(&parent_ce->default_static_members TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members TSRMLS_CC); + zend_hash_apply_with_arguments(&parent_ce->default_static_members TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, &ce->default_static_members); } zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.927&r2=1.928&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.927 php-src/ext/standard/basic_functions.c:1.928 --- php-src/ext/standard/basic_functions.c:1.927Thu Aug 21 23:37:40 2008 +++ php-src/ext/standard/basic_functions.c Fri Aug 22 15:51:50 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: basic_functions.c,v 1.927 2008/08/21 23:37:40 pajoye Exp $ */ +/* $Id: basic_functions.c,v 1.928 2008/08/22 15:51:50 felipe Exp $ */ #include "php.h" #include "php_streams.h" @@ -4945,7 +4945,7 @@ } else if (Z_TYPE_P(entry) == IS_ARRAY) { MAKE_STD_ZVAL(tmp); array_init(tmp); - zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, tmp TSRMLS_CC); + zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, tmp); add_assoc_zval_ex(retval, hash_key->arKey.s, hash_key->nKeyLength, tmp); } return 0; http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.317&r2=1.318&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.317 php-src/ext/reflection/php_reflection.c:1.318 --- php-src/ext/reflection/php_reflection.c:1.317 Mon Aug 18 19:42:38 2008 +++ php-src/ext/reflection/php_reflection.c Fri Aug 22 15:51:50 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.317 2008/08/18 19:42:38 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.318 2008/08/22 15:51:50 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1035,7 +1035,7 @@ int num_constants = 0; string_init(&str_constants); - zend_hash_apply_with_arguments(EG(zend_constants) TSRMLS_CC, (apply_func_args_t) _extension_const_string, 4, &str_constants, indent, module, &num_constants TSRMLS_CC); + zend_hash_apply_with_arguments(EG(zend_constants) TSRMLS_CC, (apply_func_args_t) _extension_const_string, 4, &str_constants, indent, module, &num_constants); if (num_constants) { string_printf(str, "\n - Constants [%d] {\n", num_constants); string_append(str, &str_constants); @@ -1072,7 +1072,7 @@ string_init(&sub_indent); string_printf(&sub_indent, "%s", indent); string_init(&str_classes); - zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) _extension_class_string, 4, &str_classes, sub_indent.string, module, &num_classes TSRMLS_CC); + zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) _extension_class_string, 4, &str_classes, sub_indent.string, module, &num_classes); if (num_classes) { string_printf(str, "\n - Classes [%d] {", num_classes);
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests ReflectionMethod_invoke_basic.phpt property_exists.phpt
felipe Mon Aug 18 19:42:39 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests ReflectionMethod_invoke_basic.phpt property_exists.phpt Log: - MFB: New parameter parsing API - Fixed tests http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.316&r2=1.317&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.316 php-src/ext/reflection/php_reflection.c:1.317 --- php-src/ext/reflection/php_reflection.c:1.316 Wed Aug 13 21:57:00 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 18 19:42:38 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.316 2008/08/13 21:57:00 pajoye Exp $ */ +/* $Id: php_reflection.c,v 1.317 2008/08/18 19:42:38 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1659,9 +1659,8 @@ ZEND_METHOD(reflection_function, invoke) { zval *retval_ptr; - zval ***params; - int result; - int argc = ZEND_NUM_ARGS(); + zval ***params = NULL; + int result, num_args = 0; zend_fcall_info fci; zend_fcall_info_cache fcc; reflection_object *intern; @@ -1670,10 +1669,8 @@ METHOD_NOTSTATIC(reflection_function_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - params = safe_emalloc(sizeof(zval **), argc, 0); - if (zend_get_parameters_array_ex(argc, params) == FAILURE) { - efree(params); - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", ¶ms, &num_args) == FAILURE) { + return; } fci.size = sizeof(fci); @@ -1682,7 +1679,7 @@ fci.symbol_table = NULL; fci.object_pp = NULL; fci.retval_ptr_ptr = &retval_ptr; - fci.param_count = argc; + fci.param_count = num_args; fci.params = params; fci.no_separation = 1; @@ -2497,22 +2494,16 @@ ZEND_METHOD(reflection_method, invoke) { zval *retval_ptr; - zval ***params; + zval ***params = NULL; zval **object_pp; reflection_object *intern; zend_function *mptr; - int argc = ZEND_NUM_ARGS(); - int result; + int result, num_args = 0; zend_fcall_info fci; zend_fcall_info_cache fcc; zend_class_entry *obj_ce; METHOD_NOTSTATIC(reflection_method_ptr); - - if (argc < 1) { - zend_error(E_WARNING, "Invoke() expects at least one parameter, none given"); - RETURN_FALSE; - } GET_REFLECTION_OBJECT_PTR(mptr); @@ -2533,10 +2524,8 @@ return; } - params = safe_emalloc(sizeof(zval **), argc, 0); - if (zend_get_parameters_array_ex(argc, params) == FAILURE) { - efree(params); - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", ¶ms, &num_args) == FAILURE) { + return; } /* In case this is a static method, we should'nt pass an object_pp @@ -2571,7 +2560,7 @@ fci.symbol_table = NULL; fci.object_pp = object_pp; fci.retval_ptr_ptr = &retval_ptr; - fci.param_count = argc-1; + fci.param_count = num_args-1; fci.params = params+1; fci.no_separation = 1; @@ -3767,14 +3756,14 @@ zval *retval_ptr = NULL; reflection_object *intern; zend_class_entry *ce; - int argc = ZEND_NUM_ARGS(); METHOD_NOTSTATIC(reflection_class_ptr); GET_REFLECTION_OBJECT_PTR(ce); /* Run the constructor if there is one */ if (ce->constructor) { - zval ***params; + zval ***params = NULL; + int num_args = 0; zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -3783,9 +3772,10 @@ return; } - params = safe_emalloc(sizeof(zval **), argc, 0); - if (zend_get_parameters_array_ex(argc, params) == FAILURE) { - efree(params); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", ¶ms, &num_args) == FAILURE) { + if (params) { + efree(params); + } RETURN_FALSE; } @@ -3797,7 +3787,7 @@ fci.symbol_table = NULL; fci.object_pp = &return_value; fci.retval_ptr_ptr = &retval_ptr; - fci.param_count = argc; + fci.param_count = num_args; fci.params = params; fci.no_separation = 1; @@ -3818,7 +3808,10 @@ if (retval_ptr) { zval_ptr_dtor(&retval_ptr);
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
pajoye Wed Aug 13 21:57:00 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - move declaration on top and fix build error http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.315&r2=1.316&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.315 php-src/ext/reflection/php_reflection.c:1.316 --- php-src/ext/reflection/php_reflection.c:1.315 Mon Aug 11 22:30:44 2008 +++ php-src/ext/reflection/php_reflection.c Wed Aug 13 21:57:00 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.315 2008/08/11 22:30:44 cseiler Exp $ */ +/* $Id: php_reflection.c,v 1.316 2008/08/13 21:57:00 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3357,9 +3357,9 @@ zend_function *closure; if (mptr->common.fn_flags & filter) { - ALLOC_ZVAL(method); unsigned int lc_name_len; zstr lc_name = zend_u_str_case_fold(ZEND_STR_TYPE, mptr->common.function_name, len, 1, &lc_name_len); + ALLOC_ZVAL(method); if (ce == zend_ce_closure && obj && (lc_name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && ZEND_U_EQUAL(ZEND_STR_TYPE, lc_name, lc_name_len, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL) @@ -5423,7 +5423,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.315 2008/08/11 22:30:44 cseiler Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.316 2008/08/13 21:57:00 pajoye Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests closures_003.phpt closures_004.phpt reflectionParameter_invalidMethodInConstructor.phpt
cseiler Mon Aug 11 22:30:44 2008 UTC Added files: /php-src/ext/reflection/tests closures_003.phpt closures_004.phpt Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests reflectionParameter_invalidMethodInConstructor.phpt Log: - Fixed sefaults (tests added) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.314&r2=1.315&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.314 php-src/ext/reflection/php_reflection.c:1.315 --- php-src/ext/reflection/php_reflection.c:1.314 Mon Aug 11 19:34:49 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 22:30:44 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.314 2008/08/11 19:34:49 helly Exp $ */ +/* $Id: php_reflection.c,v 1.315 2008/08/11 22:30:44 cseiler Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -228,6 +228,28 @@ } /* }}} */ +static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */ +{ + if (fptr + && fptr->type == ZEND_INTERNAL_FUNCTION + && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) + { + zend_function *copy_fptr; + copy_fptr = emalloc(sizeof(zend_function)); + memcpy(copy_fptr, fptr, sizeof(zend_function)); + if (UG(unicode)) { + copy_fptr->internal_function.function_name.u = eustrdup(fptr->internal_function.function_name.u); + } else { + copy_fptr->internal_function.function_name.s = estrdup(fptr->internal_function.function_name.s); + } + return copy_fptr; + } else { + /* no copy needed */ + return fptr; + } +} +/* }}} */ + static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */ { if (fptr @@ -1812,7 +1834,7 @@ zval *parameter; ALLOC_ZVAL(parameter); - reflection_parameter_factory(fptr, arg_info, i, fptr->common.required_num_args, parameter TSRMLS_CC); + reflection_parameter_factory(_copy_function(fptr TSRMLS_CC), arg_info, i, fptr->common.required_num_args, parameter TSRMLS_CC); add_next_index_zval(return_value, parameter); arg_info++; @@ -1956,7 +1978,7 @@ } else if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) { efree(lcname.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method)); + "Method %v::%R() does not exist", ce->name, Z_TYPE_PP(method), Z_UNIVAL_PP(method)); return; } efree(lcname.v); @@ -2064,9 +2086,9 @@ GET_REFLECTION_OBJECT_PTR(param); if (!param->fptr->common.scope) { - reflection_function_factory(param->fptr, return_value TSRMLS_CC); + reflection_function_factory(_copy_function(param->fptr TSRMLS_CC), return_value TSRMLS_CC); } else { - reflection_method_factory(param->fptr->common.scope, param->fptr, return_value TSRMLS_CC); + reflection_method_factory(param->fptr->common.scope, _copy_function(param->fptr TSRMLS_CC), return_value TSRMLS_CC); } } /* }}} */ @@ -2458,7 +2480,14 @@ /* Returns from this function */ } - zend_create_closure(return_value, mptr, mptr->common.scope, obj TSRMLS_CC); + /* This is an original closure object and __invoke is to be called. */ + if (Z_OBJCE_P(obj) == zend_ce_closure && mptr->type == ZEND_INTERNAL_FUNCTION && + (mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) + { + RETURN_ZVAL(obj, 1, 0); + } else { + zend_create_closure(return_value, mptr, mptr->common.scope, obj TSRMLS_CC); + } } } /* }}} */ @@ -5394,7 +5423,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.314 2008/08/11 19:34:49 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.315 2008/08/11 22:30:44 cseiler Exp $");
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c/ext/reflection/tests 024.phpt pecl/sdo/SCA/Bindings/atom .cvsignoreAtom1.0.xsd AtomDas.php Proxy.php RequestTester.php SCA_AtomServer.phpSCA
I received the warnings when commiting: Ohh. It's supposed to just fail... - Steph -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 024.phpt pecl/sdo/SCA/Bindings/atom .cvsignore Atom1.0.xsd AtomDas.php Proxy.php RequestTester.php SCA_AtomServer.php
Em Seg, 2008-08-11 às 21:24 +0200, [EMAIL PROTECTED] escreveu: > On 11/08/2008, Felipe Pena <[EMAIL PROTECTED]> wrote: > > felipe Mon Aug 11 13:35:49 2008 UTC > > > > Removed files: > > /pecl/sdo/SCA/Bindings/atom AtomDas.php Atom1.0.xsd > > ServiceRequestHandler.php > > SCA_AtomServer.php RequestTester.php > > .cvsignore xml.xsd > > SCA_ServiceWrapperAtom.php > > xhtml1-strict.xsd Proxy.php > > > > Modified files: > > /pecl/sdo/SCA/Bindings/atom binding > > Soo.. this looks confusing...? > > I can't see any changes being made (or files removed for that matter) > browsing viewvc.. and I thought this dir (along with all other IBM > projects) were CLAd and therefore with explicit unavail lines? > Yeah, That also occured to Tony times ago. I received the warnings when commiting: Use of uninitialized value in string eq at /repository/CVSROOT/loginfo.pl line 127, line 1. Use of uninitialized value in string eq at /repository/CVSROOT/loginfo.pl line 127, line 1. Use of uninitialized value in concatenation (.) or string at /repository/CVSROOT/loginfo.pl line 152. Use of uninitialized value in concatenation (.) or string at /repository/CVSROOT/loginfo.pl line 152. Use of uninitialized value in concatenation (.) or string at /repository/CVSROOT/loginfo.pl line 153. Use of uninitialized value in concatenation (.) or string at /repository/CVSROOT/loginfo.pl line 153. cvs rdiff: cannot find module `pecl/sdo/SCA/Bindings/atom/binding' - ignored 46398 Mailing the commit email to php-cvs@lists.php.net -- Regards, Felipe Pena. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 024.phpt pecl/sdo/SCA/Bindings/atom .cvsignore Atom1.0.xsd AtomDas.php Proxy.php RequestTester.php SCA_AtomServer.php
I can't see any changes being made (or files removed for that matter) browsing viewvc.. and I thought this dir (along with all other IBM projects) were CLAd and therefore with explicit unavail lines? It is. It's also not a development branch - it's the release-only branch! Best write a nice letter to Caroline :) (cem@) - Steph -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Mon Aug 11 19:34:49 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Cleanup http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.313&r2=1.314&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.313 php-src/ext/reflection/php_reflection.c:1.314 --- php-src/ext/reflection/php_reflection.c:1.313 Mon Aug 11 13:35:48 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 19:34:49 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.313 2008/08/11 13:35:48 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.314 2008/08/11 19:34:49 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -232,8 +232,8 @@ { if (fptr && fptr->type != ZEND_USER_FUNCTION - && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0 - ) { + && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) + { efree(fptr->internal_function.function_name.v); efree(fptr); } @@ -363,7 +363,7 @@ /* The information where a class is declared is only available for user classes */ if (ce->type == ZEND_USER_CLASS) { string_printf(str, "%s @@ %s %d-%d\n", indent, ce->filename, - ce->line_start, ce->line_end); + ce->line_start, ce->line_end); } /* Constants */ @@ -442,7 +442,8 @@ while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { if (mptr->common.fn_flags & ZEND_ACC_STATIC - && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { + && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) + { count_static_funcs++; } zend_hash_move_forward_ex(&ce->function_table, &pos); @@ -459,7 +460,8 @@ while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { if (mptr->common.fn_flags & ZEND_ACC_STATIC - && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { + && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) + { string_printf(str, "\n"); _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); } @@ -538,8 +540,9 @@ zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { - if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0 && - ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { + if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0 + && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) + { zstr key; uint key_len; ulong num_index; @@ -547,19 +550,19 @@ zstr lcname = zend_u_str_case_fold(ZEND_STR_TYPE, mptr->common.function_name, len, 1, &lcname_len); /* Do not display old-style inherited constructors */ - if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || - mptr->common.scope == ce || - zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING) || - (UG(unicode) -? zend_u_binary_strcmp(key.u, key_len-1, lcname.u, lcname_len) == 0 -: zend_binary_strcmp(key.s, key_len-1, lcname.s, lcname_len) == 0) - ) { + if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 + || mptr->common.scope == ce +
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 024.phpt pecl/sdo/SCA/Bindings/atom .cvsignore Atom1.0.xsd AtomDas.php Proxy.php RequestTester.php SCA_AtomServer.php
On 11/08/2008, Felipe Pena <[EMAIL PROTECTED]> wrote: > felipeMon Aug 11 13:35:49 2008 UTC > > Removed files: > /pecl/sdo/SCA/Bindings/atom AtomDas.php Atom1.0.xsd > ServiceRequestHandler.php > SCA_AtomServer.php RequestTester.php > .cvsignore xml.xsd > SCA_ServiceWrapperAtom.php > xhtml1-strict.xsd Proxy.php > > Modified files: > /pecl/sdo/SCA/Bindings/atom binding Soo.. this looks confusing...? I can't see any changes being made (or files removed for that matter) browsing viewvc.. and I thought this dir (along with all other IBM projects) were CLAd and therefore with explicit unavail lines? -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 024.phpt pecl/sdo/SCA/Bindings/atom .cvsignore Atom1.0.xsd AtomDas.php Proxy.php RequestTester.php SCA_AtomServer.php SC
felipe Mon Aug 11 13:35:49 2008 UTC Removed files: /pecl/sdo/SCA/Bindings/atom AtomDas.php Atom1.0.xsd ServiceRequestHandler.php SCA_AtomServer.php RequestTester.php .cvsignore xml.xsd SCA_ServiceWrapperAtom.php xhtml1-strict.xsd Proxy.php Modified files: /pecl/sdo/SCA/Bindings/atom binding /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests 024.phpt Log: - Fixed wrong check for dynamic properties http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/binding?r1=&r2=&diff_format=u http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.312&r2=1.313&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.312 php-src/ext/reflection/php_reflection.c:1.313 --- php-src/ext/reflection/php_reflection.c:1.312 Mon Aug 11 12:45:37 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 13:35:48 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.312 2008/08/11 12:45:37 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.313 2008/08/11 13:35:48 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -509,9 +509,8 @@ ulong index; if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { - if (prop_name_size && (UG(unicode)?prop_name.u[0]:prop_name.s[0])) { - /* skip all private and protected properties */ - if (zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { + if (prop_name_size && (UG(unicode)?prop_name.u[0]:prop_name.s[0])) { /* skip all private and protected properties */ + if (!zend_u_hash_exists(&ce->properties_info, prop_type, prop_name, prop_name_size)) { count++; _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); } @@ -5377,7 +5376,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.312 2008/08/11 12:45:37 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.313 2008/08/11 13:35:48 felipe Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/024.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/024.phpt diff -u php-src/ext/reflection/tests/024.phpt:1.2 php-src/ext/reflection/tests/024.phpt:1.3 --- php-src/ext/reflection/tests/024.phpt:1.2 Thu Apr 12 12:43:54 2007 +++ php-src/ext/reflection/tests/024.phpt Mon Aug 11 13:35:49 2008 @@ -9,7 +9,12 @@ protected $p2 = 2; public$p3 = 3; } -$obj = new ReflectionObject(new C1()); + +$x = new C1(); +$x->z = 4; +$x->p3 = 5; + +$obj = new ReflectionObject($x); echo $obj; ?> --EXPECTF-- @@ -32,7 +37,7 @@ } - Dynamic properties [1] { -Property [ public $p3 ] +Property [ public $z ] } - Methods [0] { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
felipe Mon Aug 11 12:45:37 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fix build (ZTS) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.311&r2=1.312&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.311 php-src/ext/reflection/php_reflection.c:1.312 --- php-src/ext/reflection/php_reflection.c:1.311 Mon Aug 11 12:36:00 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 12:45:37 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.311 2008/08/11 12:36:00 helly Exp $ */ +/* $Id: php_reflection.c,v 1.312 2008/08/11 12:45:37 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3369,7 +3369,7 @@ array_init(return_value); zend_hash_apply_with_arguments(&ce->function_table TSRMLS_CC, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj); - if (intern->obj && instanceof_function(ce, zend_ce_closure)) { + if (intern->obj && instanceof_function(ce, zend_ce_closure TSRMLS_CC)) { zend_function *closure = zend_get_closure_invoke_method(intern->obj TSRMLS_CC); if (closure) { _addmethod(closure, ce, return_value, filter, intern->obj TSRMLS_CC); @@ -5377,7 +5377,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.311 2008/08/11 12:36:00 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.312 2008/08/11 12:45:37 felipe Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests closures_001.phpt closures_002.phpt reflectionParameter_export_error2.phpt
helly Mon Aug 11 12:36:01 2008 UTC Added files: /php-src/ext/reflection/tests closures_001.phpt closures_002.phpt Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests reflectionParameter_export_error2.phpt Log: - Closure/Reflection integration (original idea by Christian Seiler) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.310&r2=1.311&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.310 php-src/ext/reflection/php_reflection.c:1.311 --- php-src/ext/reflection/php_reflection.c:1.310 Mon Aug 11 00:46:14 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 12:36:00 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.310 2008/08/11 00:46:14 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.311 2008/08/11 12:36:00 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -187,11 +187,18 @@ zend_function *fptr; } parameter_reference; +typedef enum { + REF_TYPE_OTHER, /* Must be 0 */ + REF_TYPE_FUNCTION, + REF_TYPE_PARAMETER, + REF_TYPE_PROPERTY, +} reflection_type_t; + /* Struct for reflection objects */ typedef struct { zend_object zo; void *ptr; - unsigned int free_ptr:1; + reflection_type_t ref_type; zval *obj; zend_class_entry *ce; } reflection_object; @@ -221,34 +228,45 @@ } /* }}} */ -static void reflection_free_objects_storage(void *object TSRMLS_DC) /* {{{ */ +static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */ { - reflection_object *intern = (reflection_object *) object; - - if (intern->free_ptr && intern->ptr) { - efree(intern->ptr); - intern->ptr = NULL; + if (fptr + && fptr->type != ZEND_USER_FUNCTION + && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0 + ) { + efree(fptr->internal_function.function_name.v); + efree(fptr); } - if (intern->obj) { - zval_ptr_dtor(&intern->obj); - } - zend_objects_free_object_storage(object TSRMLS_CC); } /* }}} */ -static void reflection_objects_clone(void *object, void **object_clone TSRMLS_DC) /* {{{ */ +static void reflection_free_objects_storage(void *object TSRMLS_DC) /* {{{ */ { reflection_object *intern = (reflection_object *) object; - reflection_object **intern_clone = (reflection_object **) object_clone; + parameter_reference *reference; - *intern_clone = emalloc(sizeof(reflection_object)); - zend_object_std_init(&(*intern_clone)->zo, intern->zo.ce TSRMLS_CC); - (*intern_clone)->ptr = intern->ptr; - (*intern_clone)->free_ptr = intern->free_ptr; - (*intern_clone)->obj = intern->obj; + if (intern->ptr) { + switch (intern->ref_type) { + case REF_TYPE_PARAMETER: + reference = (parameter_reference*)intern->ptr; + _free_function(reference->fptr TSRMLS_CC); + efree(intern->ptr); + break; + case REF_TYPE_FUNCTION: + _free_function(intern->ptr TSRMLS_CC); + break; + case REF_TYPE_PROPERTY: + efree(intern->ptr); + break; + case REF_TYPE_OTHER: + break; + } + } + intern->ptr = NULL; if (intern->obj) { - zval_add_ref(&intern->obj); + zval_ptr_dtor(&intern->obj); } + zend_objects_free_object_storage(object TSRMLS_CC); } /* }}} */ @@ -258,14 +276,12 @@ zend_object_value retval; reflection_object *intern; - intern = emalloc(sizeof(reflection_object)); - intern->ptr = NULL; - intern->obj = NULL; - intern->free_ptr = 0; + intern = ecalloc(1, sizeof(reflection_object)); + intern->zo.ce = class_type; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, reflection_objects_clone TSRMLS_CC); + retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, NULL TSRMLS_CC); retval.handlers = &reflection_object_handlers; return retval; } @@ -528,20 +544,34 @@ zstr key; uint key_len; ulong num_
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug45765.phpt
felipe Mon Aug 11 00:46:14 2008 UTC Added files: /php-src/ext/reflection/tests bug45765.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an error) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.309&r2=1.310&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.309 php-src/ext/reflection/php_reflection.c:1.310 --- php-src/ext/reflection/php_reflection.c:1.309 Fri Aug 8 10:53:39 2008 +++ php-src/ext/reflection/php_reflection.c Mon Aug 11 00:46:14 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.309 2008/08/08 10:53:39 felixdv Exp $ */ +/* $Id: php_reflection.c,v 1.310 2008/08/11 00:46:14 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -644,7 +644,7 @@ *zv = precv->op2.u.constant; zval_copy_ctor(zv); INIT_PZVAL(zv); - zval_update_constant(&zv, (void*)1 TSRMLS_CC); + zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC); if (Z_TYPE_P(zv) == IS_BOOL) { if (Z_LVAL_P(zv)) { string_write(str, "true", sizeof("true")-1); @@ -5262,7 +5262,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.309 2008/08/08 10:53:39 felixdv Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.310 2008/08/11 00:46:14 felipe Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45765.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug45765.phpt +++ php-src/ext/reflection/tests/bug45765.phpt --TEST-- Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an error) --FILE-- --EXPECTF-- Object of class [ class foo extends foo2 ] { @@ %s 7-21 - Constants [1] { Constant [ Unicode string BAR ] { foo's bar } } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Dynamic properties [0] { } - Methods [4] { Method [ public method test ] { @@ %s 10 - 11 - Parameters [1] { Parameter #0 [ $a = 'foo's bar' ] } } Method [ public method test2 ] { @@ %s 13 - 14 - Parameters [1] { Parameter #0 [ $a = 'foobar' ] } } Method [ public method test3 ] { @@ %s 16 - 17 - Parameters [1] { Parameter #0 [ $a = 'foo's bar' ] } } Method [ public method test4 ] { @@ %s 19 - 20 - Parameters [1] { Parameter #0 [ $a = 'foobar' ] } } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
felixdv Fri Aug 8 10:53:39 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: Documentation fix for getClosure() http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.308&r2=1.309&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.308 php-src/ext/reflection/php_reflection.c:1.309 --- php-src/ext/reflection/php_reflection.c:1.308 Tue Jul 29 08:48:16 2008 +++ php-src/ext/reflection/php_reflection.c Fri Aug 8 10:53:39 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.308 2008/07/29 08:48:16 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.309 2008/08/08 10:53:39 felixdv Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1589,7 +1589,7 @@ /* }}} */ /* {{{ proto public mixed ReflectionFunction::getClosure() - Invokes the function */ + Returns a dynamically created closure for the function */ ZEND_METHOD(reflection_function, getClosure) { reflection_object *intern; @@ -5262,7 +5262,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.308 2008/07/29 08:48:16 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.309 2008/08/08 10:53:39 felixdv Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Tue Jul 29 08:48:16 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: make ReflectionProperty::getValue() and ReflectionProperty::setValue() consistent with their implementations in 5_3 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.307&r2=1.308&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.307 php-src/ext/reflection/php_reflection.c:1.308 --- php-src/ext/reflection/php_reflection.c:1.307 Tue Jul 29 07:33:58 2008 +++ php-src/ext/reflection/php_reflection.c Tue Jul 29 08:48:16 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.307 2008/07/29 07:33:58 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.308 2008/07/29 08:48:16 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4267,7 +4267,7 @@ reflection_object *intern; property_reference *ref; zval *object, name; - zval **member= NULL; + zval **member= NULL, *member_p; zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; METHOD_NOTSTATIC(reflection_property_ptr); @@ -4287,19 +4287,27 @@ zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop.name); /* Bails out */ } + *return_value= **member; + zval_copy_ctor(return_value); + INIT_PZVAL(return_value); } else { + zstr class_name, prop_name; + int prop_name_len; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) { return; } - if (zend_u_hash_quick_find(Z_OBJPROP_P(object), utype, ref->prop.name, ref->prop.name_length + 1, ref->prop.h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop.name); - /* Bails out */ + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop.name, ref->prop.name_length, &class_name, &prop_name); + prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + member_p = zend_u_read_property(Z_OBJCE_P(object), object, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, 1 TSRMLS_CC); + *return_value= *member_p; + zval_copy_ctor(return_value); + INIT_PZVAL(return_value); + if (member_p != EG(uninitialized_zval_ptr)) { + zval_add_ref(&member_p); + zval_ptr_dtor(&member_p); } } - - *return_value= **member; - zval_copy_ctor(return_value); - INIT_PZVAL(return_value); } /* }}} */ @@ -4336,38 +4344,38 @@ } zend_update_class_constants(intern->ce TSRMLS_CC); prop_table = CE_STATIC_MEMBERS(intern->ce); - } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) { - return; - } - prop_table = Z_OBJPROP_P(object); - } - if (zend_u_hash_quick_find(prop_table, utype, ref->prop.name, ref->prop.name_length + 1, ref->prop.h, (void **) &variable_ptr) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop.name); - /* Bails out */ - } - if (*variable_ptr == value) { - setter_done = 1; - } else { - if (PZVAL_IS_REF(*variable_ptr)) { - zval_dtor(*variable_ptr); - (*variable_ptr)->type = value->type; - (*variable_ptr)->value = value->value; - if (Z_REFCOUNT_P(value) > 0) { - zval_copy_ctor(*variable_ptr); - } + if (zend_u_hash_quick_find(prop_table, utype, ref->prop.name, ref->prop.name_length + 1, ref->prop.h, (void **) &variable_ptr) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop.name); + /* Bails out */ + } + if (*variable_ptr == value) { setter_done = 1; + } else { + if (PZVAL_IS_REF(*variable_ptr)) { + zval_dtor(*variable_ptr); + (*variable_ptr)->type = value->type; + (*variable_ptr)->value = value->value; + if (Z_REFCOUNT_P(value) > 0) { +
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Tue Jul 29 07:33:58 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: no need for FETCH anymore.. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.306&r2=1.307&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.306 php-src/ext/reflection/php_reflection.c:1.307 --- php-src/ext/reflection/php_reflection.c:1.306 Tue Jul 29 07:32:52 2008 +++ php-src/ext/reflection/php_reflection.c Tue Jul 29 07:33:58 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.306 2008/07/29 07:32:52 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.307 2008/07/29 07:33:58 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -892,7 +892,6 @@ char *indent = va_arg(args, char *); struct _zend_module_entry *module = va_arg(args, struct _zend_module_entry*); int *num_classes = va_arg(args, int*); - TSRMLS_FETCH(); if ((*pce)->module && !strcasecmp((*pce)->module->name, module->name)) { string_printf(str, "\n"); @@ -4604,8 +4603,6 @@ int number = va_arg(args, int); if (number == ini_entry->module_number) { - TSRMLS_FETCH(); - if (ini_entry->value) { add_ascii_assoc_rt_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length, 1); } else { @@ -5257,7 +5254,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.306 2008/07/29 07:32:52 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.307 2008/07/29 07:33:58 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Tue Jul 29 07:32:52 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: more similar fixes http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.305&r2=1.306&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.305 php-src/ext/reflection/php_reflection.c:1.306 --- php-src/ext/reflection/php_reflection.c:1.305 Tue Jul 29 07:29:22 2008 +++ php-src/ext/reflection/php_reflection.c Tue Jul 29 07:32:52 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.305 2008/07/29 07:29:22 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.306 2008/07/29 07:32:52 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -850,7 +850,7 @@ } /* }}} */ -static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +static int _extension_ini_string(zend_ini_entry *ini_entry TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { string *str = va_arg(args, string *); char *indent = va_arg(args, char *); @@ -886,7 +886,7 @@ } /* }}} */ -static int _extension_class_string(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +static int _extension_class_string(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { string *str = va_arg(args, string *); char *indent = va_arg(args, char *); @@ -5257,7 +5257,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.305 2008/07/29 07:29:22 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.306 2008/07/29 07:32:52 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Tue Jul 29 07:29:22 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: add TSRMLS_DC and fix crash in ZTS mode http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.304&r2=1.305&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.304 php-src/ext/reflection/php_reflection.c:1.305 --- php-src/ext/reflection/php_reflection.c:1.304 Sat Jul 26 13:14:56 2008 +++ php-src/ext/reflection/php_reflection.c Tue Jul 29 07:29:22 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.304 2008/07/26 13:14:56 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.305 2008/07/29 07:29:22 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4565,15 +4565,13 @@ } /* }}} */ -static int _addconstant(zend_constant *constant, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ +static int _addconstant(zend_constant *constant TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { zval *const_val; zval *retval = va_arg(args, zval*); int number = va_arg(args, int); if (number == constant->module_number) { - TSRMLS_FETCH(); - ALLOC_ZVAL(const_val); *const_val = constant->value; zval_copy_ctor(const_val); @@ -5259,7 +5257,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.304 2008/07/26 13:14:56 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.305 2008/07/29 07:29:22 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
felipe Sun Jul 20 17:02:06 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - MFB: Fixed bug #45571 (ReflectionClass::export() shows superclasses' private static methods.) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.299&r2=1.300&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.299 php-src/ext/reflection/php_reflection.c:1.300 --- php-src/ext/reflection/php_reflection.c:1.299 Tue Jul 8 07:05:04 2008 +++ php-src/ext/reflection/php_reflection.c Sun Jul 20 17:02:05 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.299 2008/07/08 07:05:04 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.300 2008/07/20 17:02:05 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -416,7 +416,7 @@ /* Static methods */ if (&ce->function_table) { - /* counting static properties */ + /* counting static methods */ count = zend_hash_num_elements(&ce->function_table); if (count > 0) { HashPosition pos; @@ -425,14 +425,15 @@ zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { - if (mptr->common.fn_flags & ZEND_ACC_STATIC) { + if (mptr->common.fn_flags & ZEND_ACC_STATIC + && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { count_static_funcs++; } zend_hash_move_forward_ex(&ce->function_table, &pos); } } - /* static properties */ + /* static methods */ string_printf(str, "\n%s - Static methods [%d] {", indent, count_static_funcs); if (count_static_funcs > 0) { HashPosition pos; @@ -441,7 +442,8 @@ zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { - if (mptr->common.fn_flags & ZEND_ACC_STATIC) { + if (mptr->common.fn_flags & ZEND_ACC_STATIC + && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { string_printf(str, "\n"); _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); } @@ -5255,7 +5257,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.299 2008/07/08 07:05:04 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.300 2008/07/20 17:02:05 felipe Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
dmitry Fri Jun 27 06:43:39 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: ws http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.297&r2=1.298&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.297 php-src/ext/reflection/php_reflection.c:1.298 --- php-src/ext/reflection/php_reflection.c:1.297 Wed Jun 25 12:34:14 2008 +++ php-src/ext/reflection/php_reflection.c Fri Jun 27 06:43:38 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.297 2008/06/25 12:34:14 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.298 2008/06/27 06:43:38 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2615,7 +2615,7 @@ (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { RETURN_TRUE; -} + } RETURN_FALSE; } /* }}} */ @@ -2639,7 +2639,7 @@ (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { RETURN_UNICODEL(Z_USTRVAL_PP(name), colon.u - Z_USTRVAL_PP(name) - 1, 1); -} + } RETURN_EMPTY_TEXT(); } /* }}} */ @@ -2663,8 +2663,8 @@ (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { RETURN_UNICODEL(colon.u + 1, Z_USTRLEN_PP(name) - (colon.u - Z_USTRVAL_PP(name) + 1), 1); -} -RETURN_ZVAL(*name, 1, 0); + } + RETURN_ZVAL(*name, 1, 0); } /* }}} */ @@ -5210,7 +5210,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.297 2008/06/25 12:34:14 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.298 2008/06/27 06:43:38 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt
dmitry Wed Jun 25 12:34:14 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt Log: Added support for namespaces http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.296&r2=1.297&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.296 php-src/ext/reflection/php_reflection.c:1.297 --- php-src/ext/reflection/php_reflection.c:1.296 Sun Jun 1 03:13:54 2008 +++ php-src/ext/reflection/php_reflection.c Wed Jun 25 12:34:14 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.296 2008/06/01 03:13:54 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.297 2008/06/25 12:34:14 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2596,6 +2596,78 @@ } /* }}} */ +/* {{{ proto public bool ReflectionFunction::inNamespace() + Returns whether this function is defined in namespace */ +ZEND_METHOD(reflection_function, inNamespace) +{ + zval **name; + zstr colon; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); + if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { + RETURN_FALSE; + } + if (Z_TYPE_PP(name) == IS_STRING && + (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) && + colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') { + RETURN_TRUE; + } else if (Z_TYPE_PP(name) == IS_UNICODE && + (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && + colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { + RETURN_TRUE; +} + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto public string ReflectionFunction::getNamespaceName() + Returns the name of namespace where this function is defined */ +ZEND_METHOD(reflection_function, getNamespaceName) +{ + zval **name; + zstr colon; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); + if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { + RETURN_FALSE; + } + if (Z_TYPE_PP(name) == IS_STRING && + (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) && + colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') { + RETURN_STRINGL(Z_STRVAL_PP(name), colon.s - Z_STRVAL_PP(name) - 1, 1); + } else if (Z_TYPE_PP(name) == IS_UNICODE && + (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && + colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { + RETURN_UNICODEL(Z_USTRVAL_PP(name), colon.u - Z_USTRVAL_PP(name) - 1, 1); +} + RETURN_EMPTY_TEXT(); +} +/* }}} */ + +/* {{{ proto public string ReflectionFunction::getShortName() + Returns the short name of the function (without namespace part) */ +ZEND_METHOD(reflection_function, getShortName) +{ + zval **name; + zstr colon; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); + if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { + RETURN_FALSE; + } + if (Z_TYPE_PP(name) == IS_STRING && + (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) && + colon.s > Z_STRVAL_PP(name) && *(colon.s-1) == ':') { + RETURN_STRINGL(colon.s + 1, Z_STRLEN_PP(name) - (colon.s - Z_STRVAL_PP(name) + 1), 1); + } else if (Z_TYPE_PP(name) == IS_UNICODE && + (colon.u = u_memrchr(Z_USTRVAL_PP(name), ':', Z_USTRLEN_PP(name))) && + colon.u > Z_USTRVAL_PP(name) && *(colon.u-1) == ':') { + RETURN_UNICODEL(colon.u + 1, Z_USTRLEN_PP(name) - (colon.u - Z_USTRVAL_PP(name) + 1), 1); +} +RETURN_ZVAL(*name, 1, 0); +} +/* }}} */ + /* {{{ proto public bool ReflectionMethod::isConstructor() U Returns whether this method is the constructor */ ZEND_METHOD(reflection_method, isConstructor) @@ -3842,6 +3914,78 @@ } /* }}} */ +/* {{{ proto public bool ReflectionClass::inNamespace() + Returns whether this class is defined in namespace */ +ZEND_METHOD(reflection_class, inNamespace) +{ + zval **name; + zstr colon; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); + if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) { + RETURN_FALSE; + } + if (Z_TYPE_PP(name) == IS_STRING && + (colon.s = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) && + colon.s > Z_STRVAL_
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug45139.phpt
felipe Sun Jun 1 03:13:54 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug45139.phpt Log: - MFB: Fixed bug #45139 (ReflectionProperty returns incorrect declaring class) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.295&r2=1.296&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.295 php-src/ext/reflection/php_reflection.c:1.296 --- php-src/ext/reflection/php_reflection.c:1.295 Mon Feb 18 14:31:01 2008 +++ php-src/ext/reflection/php_reflection.c Sun Jun 1 03:13:54 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.295 2008/02/18 14:31:01 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.296 2008/06/01 03:13:54 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4202,7 +4202,7 @@ prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { - if (tmp_info->flags & ZEND_ACC_PRIVATE) { + if (tmp_info->flags & ZEND_ACC_PRIVATE || tmp_info->flags & ZEND_ACC_SHADOW) { /* it's a private property, so it can't be inherited */ break; } @@ -5060,7 +5060,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.295 2008/02/18 14:31:01 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.296 2008/06/01 03:13:54 felipe Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45139.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug45139.phpt diff -u /dev/null php-src/ext/reflection/tests/bug45139.phpt:1.2 --- /dev/null Sun Jun 1 03:13:54 2008 +++ php-src/ext/reflection/tests/bug45139.phpt Sun Jun 1 03:13:54 2008 @@ -0,0 +1,58 @@ +--TEST-- +Bug #45139 (ReflectionProperty returns incorrect declaring class) +--FILE-- +getProperty('foo'); +var_dump($rp->getDeclaringClass()->getName()); // c + +$rc = new ReflectionClass('A'); +$rp = $rc->getProperty('foo'); +var_dump($rp->getDeclaringClass()->getName()); // A + +$rc = new ReflectionClass('B'); +$rp = $rc->getProperty('bar'); +var_dump($rp->getDeclaringClass()->getName()); // B + +$rc = new ReflectionClass('C'); +$rp = $rc->getProperty('bar'); +var_dump($rp->getDeclaringClass()->getName()); // B + +$rc = new ReflectionClass('C'); +$rp = $rc->getProperty('baz'); +var_dump($rp->getDeclaringClass()->getName()); // C + +$rc = new ReflectionClass('B'); +$rp = $rc->getProperty('baz'); +var_dump($rp->getDeclaringClass()->getName()); // B + +$rc = new ReflectionClass('C'); +$rp = $rc->getProperty('quux'); +var_dump($rp->getDeclaringClass()->getName()); // C + +?> +--EXPECT-- +unicode(1) "C" +unicode(1) "A" +unicode(1) "B" +unicode(1) "B" +unicode(1) "C" +unicode(1) "B" +unicode(1) "C" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
dmitry Mon Feb 18 14:31:01 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Made code opcode-cache friendly. (It is disallowed to change code during execution) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.294&r2=1.295&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.294 php-src/ext/reflection/php_reflection.c:1.295 --- php-src/ext/reflection/php_reflection.c:1.294 Fri Feb 15 12:47:21 2008 +++ php-src/ext/reflection/php_reflection.c Mon Feb 18 14:31:01 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.294 2008/02/15 12:47:21 derick Exp $ */ +/* $Id: php_reflection.c,v 1.295 2008/02/18 14:31:01 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2178,7 +2178,6 @@ reflection_object *intern; parameter_reference *param; zend_op *precv; - zval *zv, zv_copy; METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0); GET_REFLECTION_OBJECT_PTR(param); @@ -2198,10 +2197,12 @@ return; } - zv_copy = precv->op2.u.constant; - zv = &zv_copy; - zval_update_constant_ex(&zv, (void*)0, param->fptr->common.scope TSRMLS_CC); - RETURN_ZVAL(zv, 1, 1); + *return_value = precv->op2.u.constant; + INIT_PZVAL(return_value); + if (Z_TYPE_P(return_value) != IS_CONSTANT) { + zval_copy_ctor(return_value); + } + zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC); } /* }}} */ @@ -5059,7 +5060,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.294 2008/02/15 12:47:21 derick Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.295 2008/02/18 14:31:01 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests reflectionProperty_setAccesible.phpt reflectionProperty_setAccessible.phpt
derick Fri Feb 15 12:47:21 2008 UTC Added files: /php-src/ext/reflection/tests reflectionProperty_setAccessible.phpt Removed files: /php-src/ext/reflection/tests reflectionProperty_setAccesible.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed typo http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.293&r2=1.294&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.293 php-src/ext/reflection/php_reflection.c:1.294 --- php-src/ext/reflection/php_reflection.c:1.293 Fri Feb 15 12:37:37 2008 +++ php-src/ext/reflection/php_reflection.c Fri Feb 15 12:47:21 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.293 2008/02/15 12:37:37 derick Exp $ */ +/* $Id: php_reflection.c,v 1.294 2008/02/15 12:47:21 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4229,9 +4229,9 @@ } /* }}} */ -/* {{{ proto public int ReflectionProperty::setAccesible() U +/* {{{ proto public int ReflectionProperty::setAccessible() U Sets whether non-public properties can be requested */ -ZEND_METHOD(reflection_property, setAccesible) +ZEND_METHOD(reflection_property, setAccessible) { reflection_object *intern; property_reference *ref; @@ -4859,7 +4859,7 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccesible, 0) +ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccessible, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() @@ -4880,7 +4880,7 @@ ZEND_ME(reflection_property, getDefaultValue, NULL, 0) ZEND_ME(reflection_property, getDeclaringClass, NULL, 0) ZEND_ME(reflection_property, getDocComment, NULL, 0) - ZEND_ME(reflection_property, setAccesible, arginfo_reflection_property_setAccesible, 0) + ZEND_ME(reflection_property, setAccessible, arginfo_reflection_property_setAccessible, 0) {NULL, NULL, NULL} }; @@ -5059,7 +5059,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.293 2008/02/15 12:37:37 derick Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.294 2008/02/15 12:47:21 derick Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt +++ php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt --TEST-- Test ReflectionProperty::setAccessible(). --SKIPIF-- --FILE-- getValue($instance)); } catch(Exception $exc) { echo $exc->getMessage(), "\n"; } $propInfo->setAccessible(true); var_dump($propInfo->getValue($instance)); $propInfo->setAccessible(false); try { var_dump($propInfo->getValue($instance)); } catch(Exception $exc) { echo $exc->getMessage(), "\n"; } ?> --EXPECTF-- Protected property: Cannot access non-public member TestClass::prot int(4) Cannot access non-public member TestClass::prot -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests reflectionProperty_setAccesible.phpt
derick Fri Feb 15 12:37:38 2008 UTC Added files: /php-src/ext/reflection/tests reflectionProperty_setAccesible.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Add the ReflectionProperty::setAccesible() method that allows non-public property's values to be read through ::getValue(). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.292&r2=1.293&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.292 php-src/ext/reflection/php_reflection.c:1.293 --- php-src/ext/reflection/php_reflection.c:1.292 Wed Jan 30 12:50:49 2008 +++ php-src/ext/reflection/php_reflection.c Fri Feb 15 12:37:37 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.292 2008/01/30 12:50:49 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.293 2008/02/15 12:37:37 derick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -175,6 +175,7 @@ typedef struct _property_reference { zend_class_entry *ce; zend_property_info prop; + unsigned int ignore_visibility:1; } property_reference; /* Struct for parameters */ @@ -1196,6 +1197,7 @@ reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; reference->prop = *prop; + reference->ignore_visibility = 0; intern->ptr = reference; intern->free_ptr = 1; intern->ce = ce; @@ -3939,6 +3941,7 @@ reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; reference->prop = *property_info; + reference->ignore_visibility = 0; intern->ptr = reference; intern->free_ptr = 1; intern->ce = ce; @@ -4078,7 +4081,7 @@ METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop.flags & ZEND_ACC_PUBLIC)) { + if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && ref->ignore_visibility == 0) { _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot access non-public member %v::%v", intern->ce->name, Z_UNIVAL(name)); @@ -4226,6 +4229,24 @@ } /* }}} */ +/* {{{ proto public int ReflectionProperty::setAccesible() U + Sets whether non-public properties can be requested */ +ZEND_METHOD(reflection_property, setAccesible) +{ + reflection_object *intern; + property_reference *ref; + zend_bool visible; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 1); + GET_REFLECTION_OBJECT_PTR(ref); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &visible) == FAILURE) { + return; + } + ref->ignore_visibility = visible; +} +/* }}} */ + /* {{{ proto public static mixed ReflectionExtension::export(string name [, bool return]) throws ReflectionException U Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_extension, export) @@ -4837,6 +4858,11 @@ ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() +static +ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccesible, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + static const zend_function_entry reflection_property_functions[] = { ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) @@ -4854,6 +4880,7 @@ ZEND_ME(reflection_property, getDefaultValue, NULL, 0) ZEND_ME(reflection_property, getDeclaringClass, NULL, 0) ZEND_ME(reflection_property, getDocComment, NULL, 0) + ZEND_ME(reflection_property, setAccesible, arginfo_reflection_property_setAccesible, 0) {NULL, NULL, NULL} }; @@ -5032,7 +5059,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.292 2008/01/30 12:50:49 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.293 2008/02/15 12:37:37 derick Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionProperty_setAccesible.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/reflectionProperty_setAccesible.phpt +++ php-src/ext/reflection/tests/reflectionProperty_setAccesible.phpt --TEST-- Test ReflectionProperty::setAccesible(). --SKIPIF-- --FILE-- getValue($instance)); } catch(Exception $exc) { echo $exc->getMessage(), "\n"; } $propInfo->setAccesible(true); var_dump($propInfo->getValue($instance)); $propInf
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Wed Jan 30 12:50:49 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.291&r2=1.292&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.291 php-src/ext/reflection/php_reflection.c:1.292 --- php-src/ext/reflection/php_reflection.c:1.291 Wed Jan 30 10:54:41 2008 +++ php-src/ext/reflection/php_reflection.c Wed Jan 30 12:50:49 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.291 2008/01/30 10:54:41 felipe Exp $ */ +/* $Id: php_reflection.c,v 1.292 2008/01/30 12:50:49 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3481,7 +3481,7 @@ return; } GET_REFLECTION_OBJECT_PTR(ce); - RETURN_BOOL(HAS_CLASS_ENTRY(*object) && instanceof_function(Z_OBJCE_P(object), ce)); + RETURN_BOOL(HAS_CLASS_ENTRY(*object) && instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC)); } /* }}} */ @@ -5032,7 +5032,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.291 2008/01/30 10:54:41 felipe Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.292 2008/01/30 12:50:49 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug43926.phpt
felipe Wed Jan 30 10:54:41 2008 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug43926.phpt Log: Fixed Bug #43926 (isInstance() isn't equivalent to instanceof operator) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.290&r2=1.291&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.290 php-src/ext/reflection/php_reflection.c:1.291 --- php-src/ext/reflection/php_reflection.c:1.290 Wed Jan 16 14:19:07 2008 +++ php-src/ext/reflection/php_reflection.c Wed Jan 30 10:54:41 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.290 2008/01/16 14:19:07 helly Exp $ */ +/* $Id: php_reflection.c,v 1.291 2008/01/30 10:54:41 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3481,7 +3481,7 @@ return; } GET_REFLECTION_OBJECT_PTR(ce); - RETURN_BOOL(ce == Z_OBJCE_P(object)); + RETURN_BOOL(HAS_CLASS_ENTRY(*object) && instanceof_function(Z_OBJCE_P(object), ce)); } /* }}} */ @@ -5032,7 +5032,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.290 2008/01/16 14:19:07 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.291 2008/01/30 10:54:41 felipe Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug43926.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug43926.phpt diff -u /dev/null php-src/ext/reflection/tests/bug43926.phpt:1.2 --- /dev/null Wed Jan 30 10:54:41 2008 +++ php-src/ext/reflection/tests/bug43926.phpt Wed Jan 30 10:54:41 2008 @@ -0,0 +1,37 @@ +--TEST-- +Bug#43926 - isInstance() isn't equivalent to instanceof operator +--FILE-- +newInstance(); +$cc = $rc->newInstance(); +$cd = $rd->newInstance(); +$ce = $re->newInstance(); + +print("Is? A ". ($ra->isInstance($ca) ? 'true' : 'false') .", instanceof: ". (($ca instanceof A) ? 'true' : 'false') ."\n"); +print("Is? C ". ($ra->isInstance($cc) ? 'true' : 'false') .", instanceof: ". (($ca instanceof C) ? 'true' : 'false') ."\n"); +print("Is? D ". ($ra->isInstance($cd) ? 'true' : 'false') .", instanceof: ". (($ca instanceof D) ? 'true' : 'false') ."\n"); +print("Is? E ". ($ra->isInstance($ce) ? 'true' : 'false') .", instanceof: ". (($ca instanceof E) ? 'true' : 'false') ."\n"); + +?> +--EXPECT-- +Is? A true, instanceof: true +Is? C false, instanceof: false +Is? D true, instanceof: true +Is? E true, instanceof: true \ No newline at end of file -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug37964.phpt
helly Wed Jan 16 14:19:07 2008 UTC Added files: /php-src/ext/reflection/tests bug37964.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Fixed Bug #37964 (Reflection shows private methods of parent class) ([EMAIL PROTECTED]) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.289&r2=1.290&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.289 php-src/ext/reflection/php_reflection.c:1.290 --- php-src/ext/reflection/php_reflection.c:1.289 Mon Dec 31 07:12:14 2007 +++ php-src/ext/reflection/php_reflection.c Wed Jan 16 14:19:07 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.289 2007/12/31 07:12:14 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.290 2008/01/16 14:19:07 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -519,7 +519,8 @@ zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { - if (!(mptr->common.fn_flags & ZEND_ACC_STATIC)) { + if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0 && + ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { zstr key; uint key_len; ulong num_index; @@ -541,6 +542,9 @@ zend_hash_move_forward_ex(&ce->function_table, &pos); } string_printf(str, "\n%s - Methods [%d] {", indent, count); + if (!count) { + string_printf(str, "\n"); + } string_append(str, &dyn); string_free(&dyn); } else { @@ -5028,7 +5032,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.289 2007/12/31 07:12:14 sebastian Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.290 2008/01/16 14:19:07 helly Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug37964.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug37964.phpt +++ php-src/ext/reflection/tests/bug37964.phpt --TEST-- Reflection Bug #37964 (Reflection shows private methods of parent class) --FILE-- --EXPECTF-- Class [ class bar extends foo ] { @@ %s %s - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [2] { Method [ private method foobar ] { @@ %s %d - %d } Method [ protected method test3 ] { @@ %s %d - %d } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt
iliaa Sun Oct 28 13:44:09 2007 UTC Modified files: /php-src/ext/reflection/tests bug42976.phpt /php-src/ext/reflection php_reflection.c Log: MFB: Fixed bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug42976.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug42976.phpt diff -u /dev/null php-src/ext/reflection/tests/bug42976.phpt:1.2 --- /dev/null Sun Oct 28 13:44:09 2007 +++ php-src/ext/reflection/tests/bug42976.phpt Sun Oct 28 13:44:09 2007 @@ -0,0 +1,34 @@ +--TEST-- +Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails) +--FILE-- +newInstance($x); // causes crash +var_dump($x); +$x = "x.original"; +$rc->newInstanceArgs(array($x)); // causes crash +var_dump($x); + +echo "Done\n"; +?> +--EXPECTF-- +string(9) "x.changed" + +Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d +string(10) "x.original" + +Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d +string(10) "x.original" +Done http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.286&r2=1.287&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.286 php-src/ext/reflection/php_reflection.c:1.287 --- php-src/ext/reflection/php_reflection.c:1.286 Sun Oct 7 05:15:04 2007 +++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:44:09 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.286 2007/10/07 05:15:04 davidw Exp $ */ +/* $Id: php_reflection.c,v 1.287 2007/10/28 13:44:09 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3484,7 +3484,7 @@ Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstance) { - zval *retval_ptr; + zval *retval_ptr = NULL; reflection_object *intern; zend_class_entry *ce; int argc = ZEND_NUM_ARGS(); @@ -3528,7 +3528,9 @@ if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { efree(params); - zval_ptr_dtor(&retval_ptr); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } zend_error(E_WARNING, "Invocation of %v's constructor failed", ce->name); RETURN_NULL(); } @@ -3548,7 +3550,7 @@ Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstanceArgs) { - zval *retval_ptr; + zval *retval_ptr = NULL; reflection_object *intern; zend_class_entry *ce; int argc = 0; @@ -3603,7 +3605,9 @@ if (params) { efree(params); } - zval_ptr_dtor(&retval_ptr); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } zend_error(E_WARNING, "Invocation of %v's constructor failed", ce->name); RETURN_NULL(); } @@ -5022,7 +5026,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.286 2007/10/07 05:15:04 davidw Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.287 2007/10/28 13:44:09 iliaa Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Thu Sep 27 09:14:56 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: fix coverity issue #411 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.283&r2=1.284&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.283 php-src/ext/reflection/php_reflection.c:1.284 --- php-src/ext/reflection/php_reflection.c:1.283 Tue Sep 11 11:16:46 2007 +++ php-src/ext/reflection/php_reflection.c Thu Sep 27 09:14:56 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.283 2007/09/11 11:16:46 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.284 2007/09/27 09:14:56 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2018,7 +2018,7 @@ { reflection_object *intern; parameter_reference *param; - zend_class_entry **pce; + zend_class_entry **pce, *ce; METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0); GET_REFLECTION_OBJECT_PTR(param); @@ -2038,7 +2038,7 @@ * lint-mode. */ if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) { - zend_class_entry *ce= param->fptr->common.scope; + ce = param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter uses 'self' as type hint but function is not a class member!"); @@ -2046,7 +2046,7 @@ } pce= &ce; } else if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) { - zend_class_entry *ce= param->fptr->common.scope; + ce = param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter uses 'parent' as type hint but function is not a class member!"); @@ -5022,7 +5022,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.283 2007/09/11 11:16:46 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.284 2007/09/27 09:14:56 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
dmitry Tue Sep 11 11:16:46 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Simplify (the prototype of zend_u_get_constant_ex() is going to be changed) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.282&r2=1.283&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.282 php-src/ext/reflection/php_reflection.c:1.283 --- php-src/ext/reflection/php_reflection.c:1.282 Mon Aug 20 17:01:59 2007 +++ php-src/ext/reflection/php_reflection.c Tue Sep 11 11:16:46 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.282 2007/08/20 17:01:59 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.283 2007/09/11 11:16:46 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2058,7 +2058,7 @@ return; } pce= &ce->parent; - } else if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, 1, &pce TSRMLS_CC) == FAILURE) { + } else if (zend_u_lookup_class(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; @@ -5022,7 +5022,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.282 2007/08/20 17:01:59 sebastian Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.283 2007/09/11 11:16:46 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
sebastian Mon Aug 20 17:01:59 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - MFB: Fugbix typo. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.281&r2=1.282&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.281 php-src/ext/reflection/php_reflection.c:1.282 --- php-src/ext/reflection/php_reflection.c:1.281 Fri Aug 17 14:21:00 2007 +++ php-src/ext/reflection/php_reflection.c Mon Aug 20 17:01:59 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.281 2007/08/17 14:21:00 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.282 2007/08/20 17:01:59 sebastian Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2778,7 +2778,7 @@ /* }}} */ /* {{{ proto public mixed ReflectionClass::getStaticPropertyValue(string name [, mixed default]) U - Returns the value of a tsstic property */ + Returns the value of a static property */ ZEND_METHOD(reflection_class, getStaticPropertyValue) { reflection_object *intern; @@ -5022,7 +5022,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.281 2007/08/17 14:21:00 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.282 2007/08/20 17:01:59 sebastian Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
Hello Johannes, iirc this is based on fixing a bug, thus came in later. marcus Friday, August 17, 2007, 4:21:01 PM, you wrote: > johannesFri Aug 17 14:21:01 2007 UTC > Modified files: > /php-src/ext/reflection php_reflection.c > Log: > - Mark the parameter for ReflectionProperty::GetValue as optional > # [DOC] The documentation on this is wrong, too. The parameter is only > # needed for getting the value of an object's property, not for static > # ones. (I'm not sure if it has always been that way...) > > > http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.280&r2=1.281&diff_format=u > Index: php-src/ext/reflection/php_reflection.c > diff -u php-src/ext/reflection/php_reflection.c:1.280 > php-src/ext/reflection/php_reflection.c:1.281 > --- php-src/ext/reflection/php_reflection.c:1.280 Tue Jul 24 23:16:47 > 2007 > +++ php-src/ext/reflection/php_reflection.c Fri Aug 17 14:21:00 2007 > @@ -20,7 +20,7 @@ > +--+ > */ > > -/* $Id: php_reflection.c,v 1.280 2007/07/24 23:16:47 johannes Exp $ */ > +/* $Id: php_reflection.c,v 1.281 2007/08/17 14:21:00 johannes Exp $ */ > > #ifdef HAVE_CONFIG_H > #include "config.h" > @@ -4817,7 +4817,7 @@ > ZEND_END_ARG_INFO() > > static > -ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_getValue, 0) > +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_getValue, 0, 0, 0) > ZEND_ARG_INFO(0, object) > ZEND_END_ARG_INFO() > > @@ -5022,7 +5022,7 @@ > php_info_print_table_start(); > php_info_print_table_header(2, "Reflection", "enabled"); > > - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v > 1.280 2007/07/24 23:16:47 johannes Exp $"); > + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v > 1.281 2007/08/17 14:21:00 johannes Exp $"); > > php_info_print_table_end(); > } /* }}} */ Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
johannesFri Aug 17 14:21:01 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Mark the parameter for ReflectionProperty::GetValue as optional # [DOC] The documentation on this is wrong, too. The parameter is only # needed for getting the value of an object's property, not for static # ones. (I'm not sure if it has always been that way...) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.280&r2=1.281&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.280 php-src/ext/reflection/php_reflection.c:1.281 --- php-src/ext/reflection/php_reflection.c:1.280 Tue Jul 24 23:16:47 2007 +++ php-src/ext/reflection/php_reflection.c Fri Aug 17 14:21:00 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.280 2007/07/24 23:16:47 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.281 2007/08/17 14:21:00 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4817,7 +4817,7 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_getValue, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_getValue, 0, 0, 0) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() @@ -5022,7 +5022,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.280 2007/07/24 23:16:47 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.281 2007/08/17 14:21:00 johannes Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 026.phpt
johannesTue Jul 24 23:16:47 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests 026.phpt Log: - MFB: New ReflectionExtension::info() function to print the phpinfo() block for an extension. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.279&r2=1.280&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.279 php-src/ext/reflection/php_reflection.c:1.280 --- php-src/ext/reflection/php_reflection.c:1.279 Mon Jul 23 01:21:04 2007 +++ php-src/ext/reflection/php_reflection.c Tue Jul 24 23:16:47 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.279 2007/07/23 01:21:04 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.280 2007/07/24 23:16:47 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4512,6 +4512,20 @@ } /* }}} */ +/* {{{ proto public void ReflectionExtension::info() U + Prints phpinfo block for the extension */ +ZEND_METHOD(reflection_extension, info) +{ + reflection_object *intern; + zend_module_entry *module; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0); + GET_REFLECTION_OBJECT_PTR(module); + + php_info_print_module(module TSRMLS_CC); +} +/* }}} */ + /* {{{ method tables */ static zend_function_entry reflection_exception_functions[] = { {NULL, NULL, NULL} @@ -4889,6 +4903,7 @@ ZEND_ME(reflection_extension, getClasses, NULL, 0) ZEND_ME(reflection_extension, getClassNames, NULL, 0) ZEND_ME(reflection_extension, getDependencies, NULL, 0) + ZEND_ME(reflection_extension, info, NULL, 0) {NULL, NULL, NULL} }; /* }}} */ @@ -5007,7 +5022,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.279 2007/07/23 01:21:04 bjori Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.280 2007/07/24 23:16:47 johannes Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/026.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/026.phpt diff -u /dev/null php-src/ext/reflection/tests/026.phpt:1.2 --- /dev/null Tue Jul 24 23:16:47 2007 +++ php-src/ext/reflection/tests/026.phpt Tue Jul 24 23:16:47 2007 @@ -0,0 +1,36 @@ +--TEST-- +reflectionExtension::info() +--SKIPIF-- + +--FILE-- +info(); + +date_default_timezone_set('Europe/Berlin'); +$r = new ReflectionExtension("date"); +$r->info(); + +echo "\nDone!\n"; + +--EXPECTF-- +Reflection + +Reflection => enabled +Version => %s + +date + +date/time support => enabled +"Olson" Timezone Database Version => %s +Timezone Database => %s +Default timezone => %s + +Directive => %s => %s +date.timezone => %s => %s +date.default_latitude => %s => %s +date.default_longitude => %s => %s +date.sunset_zenith => %s => %s +date.sunrise_zenith => %s => %s + +Done! -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Mon Jul 23 01:21:04 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: Avoid endless loop http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.278&r2=1.279&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.278 php-src/ext/reflection/php_reflection.c:1.279 --- php-src/ext/reflection/php_reflection.c:1.278 Wed Jul 11 22:03:59 2007 +++ php-src/ext/reflection/php_reflection.c Mon Jul 23 01:21:04 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.278 2007/07/11 22:03:59 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.279 2007/07/23 01:21:04 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -996,6 +996,7 @@ while (func->fname) { if (zend_ascii_hash_find(EG(function_table), func->fname, strlen(func->fname) + 1, (void**) &fptr) == FAILURE) { zend_error(E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname); + func++; continue; } @@ -4327,6 +4328,7 @@ while (func->fname) { if (zend_ascii_hash_find(EG(function_table), func->fname, strlen(func->fname) + 1, (void**) &fptr) == FAILURE) { zend_error(E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname); + func++; continue; } @@ -5005,7 +5007,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.278 2007/07/11 22:03:59 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.279 2007/07/23 01:21:04 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug41884.phpt
tony2001Wed Jul 11 22:03:59 2007 UTC Added files: /php-src/ext/reflection/tests bug41884.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: implement (or fix?) #41884 (ReflectionClass::getDefaultProperties() does not handle static attributes) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.277&r2=1.278&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.277 php-src/ext/reflection/php_reflection.c:1.278 --- php-src/ext/reflection/php_reflection.c:1.277 Wed Jul 11 13:26:47 2007 +++ php-src/ext/reflection/php_reflection.c Wed Jul 11 22:03:59 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.277 2007/07/11 13:26:47 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.278 2007/07/11 22:03:59 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2852,7 +2852,8 @@ { reflection_object *intern; zend_class_entry *ce; - int count; + int count, i; + HashTable *ht_list[3]; METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); @@ -2860,34 +2861,40 @@ zend_update_class_constants(ce TSRMLS_CC); - count = zend_hash_num_elements(&ce->default_properties); - if (count > 0) { - HashPosition pos; - zval **prop; + ht_list[0] = CE_STATIC_MEMBERS(ce); + ht_list[1] = &ce->default_properties; + ht_list[2] = NULL; /* this should be always the last element */ - zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos); - while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) { - zstr key, class_name, prop_name; - uint key_len; - ulong num_index; - zval *prop_copy; + for (i = 0; ht_list[i] != NULL; i++) { + count = zend_hash_num_elements(ht_list[i]); + if (count > 0) { + HashPosition pos; + zval **prop; - zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos); - zend_hash_move_forward_ex(&ce->default_properties, &pos); - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); - if (class_name.s && class_name.s[0] != '*' && - (UG(unicode)?u_strcmp(class_name.u, ce->name.u):strcmp(class_name.s, ce->name.s))) { - /* filter privates from base classes */ - continue; - } + zend_hash_internal_pointer_reset_ex(ht_list[i], &pos); + while (zend_hash_get_current_data_ex(ht_list[i], (void **) &prop, &pos) == SUCCESS) { + zstr key, class_name, prop_name; + uint key_len; + ulong num_index; + zval *prop_copy; + + zend_hash_get_current_key_ex(ht_list[i], &key, &key_len, &num_index, 0, &pos); + zend_hash_move_forward_ex(ht_list[i], &pos); + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); + if (class_name.s && class_name.s[0] != '*' && + (UG(unicode)?u_strcmp(class_name.u, ce->name.u):strcmp(class_name.s, ce->name.s))) { + /* filter privates from base classes */ + continue; + } - /* copy: enforce read only access */ - ALLOC_ZVAL(prop_copy); - *prop_copy = **prop; - zval_copy_ctor(prop_copy); - INIT_PZVAL(prop_copy); + /* copy: enforce read only access */ + ALLOC_ZVAL(prop_copy); + *prop_copy = **prop; + zval_copy_ctor(prop_copy); + INIT_PZVAL(prop_copy); - add_u_assoc_zval(return_value, ZEND_STR_TYPE, prop_name, prop_copy); + add_u_assoc_zval(return_value, ZEND_STR_TYPE, prop_name, prop_copy); + } } } } @@ -4998,7 +5005,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); -
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Wed Jul 11 13:26:47 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: fix typo and bug #41962 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.276&r2=1.277&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.276 php-src/ext/reflection/php_reflection.c:1.277 --- php-src/ext/reflection/php_reflection.c:1.276 Fri Jul 6 12:11:20 2007 +++ php-src/ext/reflection/php_reflection.c Wed Jul 11 13:26:47 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.276 2007/07/06 12:11:20 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.277 2007/07/11 13:26:47 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3697,7 +3697,7 @@ case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, - "Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); + "Class %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); return; } class_ce = *pce; @@ -4998,7 +4998,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.276 2007/07/06 12:11:20 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.277 2007/07/11 13:26:47 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Fri Jul 6 12:11:20 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: fix folding http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.275&r2=1.276&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.275 php-src/ext/reflection/php_reflection.c:1.276 --- php-src/ext/reflection/php_reflection.c:1.275 Mon May 28 10:34:37 2007 +++ php-src/ext/reflection/php_reflection.c Fri Jul 6 12:11:20 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.275 2007/05/28 10:34:37 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.276 2007/07/06 12:11:20 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -196,7 +196,7 @@ static zend_object_handlers reflection_object_handlers; -static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) +static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -208,16 +208,18 @@ zval_copy_ctor(return_value); INIT_PZVAL(return_value); } +/* }}} */ -static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC) +static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC) /* {{{ */ { zend_uint num_interfaces = ++class_entry->num_interfaces; class_entry->interfaces = (zend_class_entry **) realloc(class_entry->interfaces, sizeof(zend_class_entry *) * num_interfaces); class_entry->interfaces[num_interfaces - 1] = interface_entry; } +/* }}} */ -static void reflection_free_objects_storage(void *object TSRMLS_DC) +static void reflection_free_objects_storage(void *object TSRMLS_DC) /* {{{ */ { reflection_object *intern = (reflection_object *) object; @@ -230,8 +232,9 @@ } zend_objects_free_object_storage(object TSRMLS_CC); } +/* }}} */ -static void reflection_objects_clone(void *object, void **object_clone TSRMLS_DC) +static void reflection_objects_clone(void *object, void **object_clone TSRMLS_DC) /* {{{ */ { reflection_object *intern = (reflection_object *) object; reflection_object **intern_clone = (reflection_object **) object_clone; @@ -245,8 +248,9 @@ zval_add_ref(&intern->obj); } } +/* }}} */ -static zend_object_value reflection_objects_new(zend_class_entry *class_type TSRMLS_DC) +static zend_object_value reflection_objects_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { zval tmp; zend_object_value retval; @@ -263,8 +267,9 @@ retval.handlers = &reflection_object_handlers; return retval; } +/* }}} */ -static zval * reflection_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) +static zval * reflection_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) /* {{{ */ { if (!object) { ALLOC_ZVAL(object); @@ -275,6 +280,7 @@ object->is_ref = 1; return object; } +/* }}} */ static void _const_string(string *str, zstr name, zval *value, char *indent TSRMLS_DC); static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char *indent TSRMLS_DC); @@ -836,7 +842,7 @@ } /* }}} */ -static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_list args, zend_hash_key *hash_key) +static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { string *str = va_arg(args, string *); char *indent = va_arg(args, char *); @@ -870,8 +876,9 @@ } return ZEND_HASH_APPLY_KEEP; } +/* }}} */ -static int _extension_class_string(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key) +static int _extension_class_string(zend_class_entry **pce, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { string *str = va_arg(args, string *); char *indent = va_arg(args, char *); @@ -886,8 +893,9 @@ } return ZEND_HASH_APPLY_KEEP; } +/* }}} */ -static int _extension_const_string(zend_constant *constant, int num_args, va_list args, zend_hash_key *hash_key) +static int _extension_const_string(zend_constant *constant, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { string *str = va_arg(args, string *); char *indent = va_arg(args, char *); @@ -901,6 +909,7 @@ } return ZEND_HASH_APPLY_KEEP; } +/* }}} */ /* {{{ _extension_string */ static void _extension_string(string *str, zend_module_entry *module, char *indent TSRMLS_DC) @@ -3944,7 +3953,7 @@ } /* }}} */ -static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) +static
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Mon May 28 10:34:37 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Fix logic http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.274&r2=1.275&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.274 php-src/ext/reflection/php_reflection.c:1.275 --- php-src/ext/reflection/php_reflection.c:1.274 Sat Mar 17 23:38:41 2007 +++ php-src/ext/reflection/php_reflection.c Mon May 28 10:34:37 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.274 2007/03/17 23:38:41 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.275 2007/05/28 10:34:37 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -845,7 +845,7 @@ if (number == ini_entry->module_number) { string_printf(str, "%sEntry [ %s <", indent, ini_entry->name); - if (ini_entry->modifiable & ZEND_INI_ALL) { + if (ini_entry->modifiable == ZEND_INI_ALL) { string_printf(str, "ALL"); } else { if (ini_entry->modifiable & ZEND_INI_USER) { @@ -4987,7 +4987,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.274 2007/03/17 23:38:41 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.275 2007/05/28 10:34:37 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39884.phpt
johannesSat Mar 17 23:38:41 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug39884.phpt Log: - Fix string compare in unicode mode http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.273&r2=1.274&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.273 php-src/ext/reflection/php_reflection.c:1.274 --- php-src/ext/reflection/php_reflection.c:1.273 Sat Mar 17 22:59:22 2007 +++ php-src/ext/reflection/php_reflection.c Sat Mar 17 23:38:41 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.273 2007/03/17 22:59:22 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.274 2007/03/17 23:38:41 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2027,7 +2027,7 @@ * TODO: Think about moving these checks to the compiler or some sort of * lint-mode. */ - if (0 == strncmp(param->arg_info->class_name.v, "self", sizeof("self")- 1)) { + if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) { zend_class_entry *ce= param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -2035,7 +2035,7 @@ return; } pce= &ce; - } else if (0 == strncmp(param->arg_info->class_name.v, "parent", sizeof("parent")- 1)) { + } else if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) { zend_class_entry *ce= param->fptr->common.scope; if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -4987,7 +4987,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.273 2007/03/17 22:59:22 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.274 2007/03/17 23:38:41 johannes Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39884.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug39884.phpt diff -u php-src/ext/reflection/tests/bug39884.phpt:1.2 php-src/ext/reflection/tests/bug39884.phpt:1.3 --- php-src/ext/reflection/tests/bug39884.phpt:1.2 Fri Dec 22 15:38:42 2006 +++ php-src/ext/reflection/tests/bug39884.phpt Sat Mar 17 23:38:41 2007 @@ -20,3 +20,9 @@ ["name"]=> string(13) "stubParamTest" } +--UEXPECT-- +object(ReflectionClass)#4 (1) { + [u"name"]=> + unicode(13) "stubParamTest" +} + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Sat Mar 17 22:59:22 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: fix #40794 (ReflectionObject::getValues() may crash when used with dynamic properties) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.272&r2=1.273&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.272 php-src/ext/reflection/php_reflection.c:1.273 --- php-src/ext/reflection/php_reflection.c:1.272 Fri Mar 16 06:42:01 2007 +++ php-src/ext/reflection/php_reflection.c Sat Mar 17 22:59:22 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.272 2007/03/16 06:42:01 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.273 2007/03/17 22:59:22 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -174,7 +174,7 @@ /* Struct for properties */ typedef struct _property_reference { zend_class_entry *ce; - zend_property_info *prop; + zend_property_info prop; } property_reference; /* Struct for parameters */ @@ -1180,7 +1180,7 @@ intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; - reference->prop = prop; + reference->prop = *prop; intern->ptr = reference; intern->free_ptr = 1; intern->ce = ce; @@ -3267,7 +3267,7 @@ ZVAL_STRINGL(&member, hash_key->arKey.s, hash_key->nKeyLength-1, 0); } if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) { - ALLOC_ZVAL(property); + MAKE_STD_ZVAL(property); reflection_property_factory(ce, &EG(std_property_info), property TSRMLS_CC); add_next_index_zval(retval, property); } @@ -3912,7 +3912,7 @@ reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; - reference->prop = property_info; + reference->prop = *property_info; intern->ptr = reference; intern->free_ptr = 1; intern->ce = ce; @@ -3930,7 +3930,7 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); string_init(&str); - _property_string(&str, ref->prop, NULL_ZSTR, "" TSRMLS_CC); + _property_string(&str, &ref->prop, NULL_ZSTR, "" TSRMLS_CC); RETURN_U_STRINGL(ZEND_U_CONVERTER(UG(output_encoding_conv)), str.string, str.len - 1, ZSTR_AUTOFREE); } /* }}} */ @@ -3951,7 +3951,7 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); - RETURN_BOOL(ref->prop->flags & mask); + RETURN_BOOL(ref->prop.flags & mask); } /* {{{ proto public bool ReflectionProperty::isPublic() U @@ -4007,13 +4007,13 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); - if (ref->prop->flags & ZEND_ACC_STATIC) { + if (ref->prop.flags & ZEND_ACC_STATIC) { prop_defaults = &ref->ce->default_static_members; } else { prop_defaults = &ref->ce->default_properties; } - if (zend_u_hash_quick_find(prop_defaults, utype, ref->prop->name, ref->prop->name_length+1, ref->prop->h, (void**)&zdef) == SUCCESS) { + if (zend_u_hash_quick_find(prop_defaults, utype, ref->prop.name, ref->prop.name_length+1, ref->prop.h, (void**)&zdef) == SUCCESS) { ALLOC_ZVAL(zv); *zv = **zdef; zval_copy_ctor(zv); @@ -4034,7 +4034,7 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); - RETURN_LONG(ref->prop->flags); + RETURN_LONG(ref->prop.flags); } /* }}} */ @@ -4051,7 +4051,7 @@ METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); - if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { + if (!(ref->prop.flags & ZEND_ACC_PUBLIC)) { _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot access non-public member %v::%v", intern->ce->name, Z_UNIVAL(name)); @@ -4059,18 +4059,18 @@ return; } - if ((ref->prop->flags & ZEND_ACC_STATIC)) { + if ((ref->prop.flags & ZEND_ACC_STATIC)) { zend_update_class_constants(intern->ce TSRMLS_CC); - if (zend_u_hash_quick_find(CE_STATIC_MEMBERS(intern->ce), utype, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->pro
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
sebastian Fri Mar 16 06:42:01 2007 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: Fugbix typo. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.271&r2=1.272&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.271 php-src/ext/reflection/php_reflection.c:1.272 --- php-src/ext/reflection/php_reflection.c:1.271 Sat Feb 10 20:51:42 2007 +++ php-src/ext/reflection/php_reflection.c Fri Mar 16 06:42:01 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.271 2007/02/10 20:51:42 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.272 2007/03/16 06:42:01 sebastian Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -264,7 +264,7 @@ return retval; } -static zval * reflection_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC) +static zval * reflection_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) { if (!object) { ALLOC_ZVAL(object); @@ -1038,7 +1038,7 @@ MAKE_STD_ZVAL(name); ZVAL_TEXTL(name, ce->name, ce->name_length, 1); - reflection_instanciate(reflection_class_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_class_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = ce; intern->free_ptr = 0; @@ -1064,7 +1064,7 @@ } free_alloca(lcname); - reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_extension_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); MAKE_STD_ZVAL(name); ZVAL_ASCII_STRINGL(name, module->name, name_len, 1); @@ -1088,7 +1088,7 @@ } else { ZVAL_NULL(name); } - reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_parameter_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (parameter_reference*) emalloc(sizeof(parameter_reference)); reference->arg_info = arg_info; @@ -,7 +,7 @@ MAKE_STD_ZVAL(name); ZVAL_TEXT(name, function->common.function_name, 1); - reflection_instanciate(reflection_function_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_function_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = function; intern->free_ptr = 0; @@ -1131,7 +1131,7 @@ MAKE_STD_ZVAL(classname); ZVAL_TEXT(name, method->common.function_name, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - reflection_instanciate(reflection_method_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_method_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = method; intern->free_ptr = 0; @@ -1176,7 +1176,7 @@ ZVAL_TEXT(name, prop_name, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - reflection_instanciate(reflection_property_ptr, object TSRMLS_CC); + reflection_instantiate(reflection_property_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; @@ -4987,7 +4987,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.271 2007/02/10 20:51:42 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.272 2007/03/16 06:42:01 sebastian Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug40431.phpt
tony2001Sat Feb 10 20:51:42 2007 UTC Added files: /php-src/ext/reflection/tests bug40431.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: fix #40431 (dynamic properties may cause crash in ReflectionProperty methods) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.270&r2=1.271&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.270 php-src/ext/reflection/php_reflection.c:1.271 --- php-src/ext/reflection/php_reflection.c:1.270 Mon Jan 1 09:29:28 2007 +++ php-src/ext/reflection/php_reflection.c Sat Feb 10 20:51:42 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.270 2007/01/01 09:29:28 sebastian Exp $ */ +/* $Id: php_reflection.c,v 1.271 2007/02/10 20:51:42 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1155,15 +1155,20 @@ if (!(prop->flags & ZEND_ACC_PRIVATE)) { /* we have to search the class hierarchy for this (implicit) public or protected property */ - zend_class_entry *tmp_ce = ce; - zend_property_info *tmp_info; + zend_class_entry *tmp_ce = ce, *store_ce = ce; + zend_property_info *tmp_info = NULL; int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, utype, prop_name, prop_name_len + 1, (void **) &tmp_info) != SUCCESS) { ce = tmp_ce; - prop = tmp_info; tmp_ce = tmp_ce->parent; } + + if (tmp_info && !(tmp_info->flags & ZEND_ACC_SHADOW)) { /* found something and it's not a parent's private */ + prop = tmp_info; + } else { /* not found, use initial value */ + ce = store_ce; + } } MAKE_STD_ZVAL(name); @@ -4982,7 +4987,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.270 2007/01/01 09:29:28 sebastian Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.271 2007/02/10 20:51:42 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug40431.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug40431.phpt +++ php-src/ext/reflection/tests/bug40431.phpt --TEST-- Bug #40431 (dynamic properties may cause crash in ReflectionProperty methods) --FILE-- value = 'value'; $RefObj = new ReflectionObject($Obj); $props = $RefObj->getProperties(); var_dump($props); var_dump($props[0]->isStatic()); var_dump($props[0]->isPrivate()); var_dump($props[0]->isPublic()); var_dump($props[0]->isProtected()); echo "=== 2nd test ===\n"; class test1 { } class test2 extends test1{ } $Obj = new test2; $Obj->value = 'value'; $RefObj = new ReflectionObject($Obj); $props = $RefObj->getProperties(); var_dump($props); var_dump($props[0]->isStatic()); var_dump($props[0]->isPrivate()); var_dump($props[0]->isPublic()); var_dump($props[0]->isProtected()); echo "=== 3rd test ===\n"; class test3 { } $Obj = new test3; $Obj->value = 'value'; $RefObj = new ReflectionObject($Obj); $props = $RefObj->getProperties(); var_dump($props); var_dump($props[0]->isStatic()); var_dump($props[0]->isPrivate()); var_dump($props[0]->isPublic()); var_dump($props[0]->isProtected()); echo "=== 4th test ===\n"; class test5 { private $value = 1; } class test4 extends test5{ } $Obj = new test4; $Obj->value = 'value'; $RefObj = new ReflectionObject($Obj); $props = $RefObj->getProperties(); var_dump($props); var_dump($props[0]->isStatic()); var_dump($props[0]->isPrivate()); var_dump($props[0]->isPublic()); var_dump($props[0]->isProtected()); echo "Done\n"; ?> --EXPECTF-- === 1st test === Strict Standards: Creating default object from empty value in %s on line %d array(1) { [0]=> &object(ReflectionProperty)#%d (2) { ["name"]=> string(5) "value" ["class"]=> string(8) "stdClass" } } bool(false) bool(false) bool(true) bool(false) === 2nd test === array(1) { [0]=> &object(ReflectionProperty)#%d (2) { ["name"]=> string(5) "value" ["class"]=> string(5) "test2" } } bool(false) bool(false) bool(true) bool(false) === 3rd test === array(1) { [0]=> &object(ReflectionProperty)#%d (2) { ["name"]=> string(5) "value" ["class"]=> string(5) "test3" } } bool(false) bool(false) bool(true) bool(false) === 4th test === array(1) { [0]=> &object(ReflectionProperty)#%d (2) { ["name"]=> string(5) "value" ["class"]=> string(5) "t
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39884.phpt
iliaa Fri Dec 22 15:38:42 2006 UTC Modified files: /php-src/ext/reflection/tests bug39884.phpt /php-src/ext/reflection php_reflection.c Log: MFB: Fixed bug #39884 (ReflectionParameter::getClass() throws exception for type hint self). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39884.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug39884.phpt diff -u /dev/null php-src/ext/reflection/tests/bug39884.phpt:1.2 --- /dev/null Fri Dec 22 15:38:42 2006 +++ php-src/ext/reflection/tests/bug39884.phpt Fri Dec 22 15:38:42 2006 @@ -0,0 +1,22 @@ +--TEST-- +Bug #39884 (ReflectionParameter::getClass() throws exception for type hint self) +--FILE-- +paramTest($test2); +$refParam = new ReflectionParameter(array('stubParamTest', 'paramTest'), 'param'); +var_dump($refParam->getClass()); +?> +--EXPECT-- +object(ReflectionClass)#4 (1) { + ["name"]=> + string(13) "stubParamTest" +} http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.268&r2=1.269&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.268 php-src/ext/reflection/php_reflection.c:1.269 --- php-src/ext/reflection/php_reflection.c:1.268 Tue Dec 19 21:38:59 2006 +++ php-src/ext/reflection/php_reflection.c Fri Dec 22 15:38:42 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.268 2006/12/19 21:38:59 andrei Exp $ */ +/* $Id: php_reflection.c,v 1.269 2006/12/22 15:38:42 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2009,7 +2009,41 @@ GET_REFLECTION_OBJECT_PTR(param); if (param->arg_info->class_name.v) { - if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, 1, &pce TSRMLS_CC) == FAILURE) { + + /* Class name is stored as a string, we might also get "self" or "parent" +* - For "self", simply use the function scope. If scope is NULL then +* the function is global and thus self does not make any sense +* +* - For "parent", use the function scope's parent. If scope is NULL then +* the function is global and thus parent does not make any sense. +* If the parent is NULL then the class does not extend anything and +* thus parent does not make any sense, either. +* +* TODO: Think about moving these checks to the compiler or some sort of +* lint-mode. +*/ + if (0 == strncmp(param->arg_info->class_name.v, "self", sizeof("self")- 1)) { + zend_class_entry *ce= param->fptr->common.scope; + if (!ce) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + "Parameter uses 'self' as type hint but function is not a class member!"); + return; + } + pce= &ce; + } else if (0 == strncmp(param->arg_info->class_name.v, "parent", sizeof("parent")- 1)) { + zend_class_entry *ce= param->fptr->common.scope; + if (!ce) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + "Parameter uses 'parent' as type hint but function is not a class member!"); + return; + } + if (!ce->parent) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + "Parameter uses 'parent' as type hint although class does not have a parent!"); + return; + } + pce= &ce->parent; + } else if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, 1, &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; @@ -4948,7 +4982,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.268 2006/12/19 21:38:59 andrei Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.269 2006/12/22 15:38:42 iliaa Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/standard array.c basic_functions.c string.c ZendEngine2 zend_API.h zend_execute_API.c
Hello Andrei, you're right again. This versionis actually in line with the order of zend_u_hash*(), too. best regards marcus Tuesday, December 19, 2006, 10:39:00 PM, you wrote: > andrei Tue Dec 19 21:39:00 2006 UTC > Modified files: > /ZendEngine2zend_API.h zend_execute_API.c > /php-src/ext/reflection php_reflection.c > /php-src/ext/standard array.c basic_functions.c string.c > Log: > - Marcus was too quick. Let's put type before zstr in the macros. > - Also mark get_include_path() and restore_include_path() with U. > > Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/standard array.c basic_functions.c string.c ZendEngine2 zend_API.h zend_execute_API.c
andrei Tue Dec 19 21:39:00 2006 UTC Modified files: /ZendEngine2zend_API.h zend_execute_API.c /php-src/ext/reflection php_reflection.c /php-src/ext/standard array.c basic_functions.c string.c Log: - Marcus was too quick. Let's put type before zstr in the macros. - Also mark get_include_path() and restore_include_path() with U. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.274&r2=1.275&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.274 ZendEngine2/zend_API.h:1.275 --- ZendEngine2/zend_API.h:1.274Tue Dec 19 21:12:16 2006 +++ ZendEngine2/zend_API.h Tue Dec 19 21:38:59 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.h,v 1.274 2006/12/19 21:12:16 helly Exp $ */ +/* $Id: zend_API.h,v 1.275 2006/12/19 21:38:59 andrei Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -389,13 +389,13 @@ #define add_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -532,13 +532,13 @@ #define add_ascii_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_ascii_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_ascii_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -676,13 +676,13 @@ #define add_rt_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_rt_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_rt_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -820,13 +820,13 @@ #define add_utf8_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_utf8_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_utf8_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -972,14 +972,14 @@ #define add_utf8_property_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \ } while (0) #define add_utf8_property_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(_
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c ZendEngine2 zend.h zend_API.c zend_API.h zend_compile.c zend_compile.h zend_globals.h zend_language_scanner.l
andrei Fri Oct 27 21:22:06 2006 UTC Modified files: /ZendEngine2zend.h zend_API.c zend_API.h zend_compile.c zend_compile.h zend_globals.h zend_language_scanner.l /php-src/ext/reflection php_reflection.c Log: Turn doc comments into zstr strings with corresponding adjustments. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.h?r1=1.329&r2=1.330&diff_format=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.329 ZendEngine2/zend.h:1.330 --- ZendEngine2/zend.h:1.329Mon Oct 16 21:13:13 2006 +++ ZendEngine2/zend.h Fri Oct 27 21:22:05 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend.h,v 1.329 2006/10/16 21:13:13 andrei Exp $ */ +/* $Id: zend.h,v 1.330 2006/10/27 21:22:05 andrei Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -399,7 +399,7 @@ char *filename; zend_uint line_start; zend_uint line_end; - char *doc_comment; + zstr doc_comment; zend_uint doc_comment_len; struct _zend_module_entry *module; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.413&r2=1.414&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.413 ZendEngine2/zend_API.c:1.414 --- ZendEngine2/zend_API.c:1.413Tue Oct 17 22:15:19 2006 +++ ZendEngine2/zend_API.c Fri Oct 27 21:22:05 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.c,v 1.413 2006/10/17 22:15:19 andrei Exp $ */ +/* $Id: zend_API.c,v 1.414 2006/10/27 21:22:05 andrei Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2902,7 +2902,7 @@ return module->version; } -ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) +ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC) { zend_property_info property_info; HashTable *target_symbol_table; @@ -2977,19 +2977,19 @@ return SUCCESS; } -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC) { - return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL, 0 TSRMLS_CC); + return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, doc_comment, doc_comment_len TSRMLS_CC); } ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC) { - return zend_u_declare_property_ex(ce, type, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); + return zend_u_declare_property_ex(ce, type, name, name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC); } ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) { - return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL, 0 TSRMLS_CC); + return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL_ZSTR, 0 TSRMLS_CC); } ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.267&r2=1.268&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.267 ZendEngine2/zend_API.h:1.268 --- ZendEngine2/zend_API.h:1.267Tue Oct 24 12:46:33 2006 +++ ZendEngine2/zend_API.h Fri Oct 27 21:22:05 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.h,v 1.267 2006/10/24 12:46:33 tony2001 Exp $ */ +/* $Id: zend_API.h,v 1.268 2006/10/27 21:22:05 andrei Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -224,7 +224,7 @@ ZEND_API char *zend_get_module_version(char *module_name); ZEND_API int zend_get_module_started(char *module_name); ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC); +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
andrei Tue Oct 24 17:37:17 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Mark reflection methods as Unicode-compliant (except for FIXME parts). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.264&r2=1.265&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.264 php-src/ext/reflection/php_reflection.c:1.265 --- php-src/ext/reflection/php_reflection.c:1.264 Mon Oct 23 20:00:40 2006 +++ php-src/ext/reflection/php_reflection.c Tue Oct 24 17:37:17 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.264 2006/10/23 20:00:40 andrei Exp $ */ +/* $Id: php_reflection.c,v 1.265 2006/10/24 17:37:17 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1292,7 +1292,7 @@ } /* }}} */ -/* {{{ proto public static mixed Reflection::export(Reflector r [, bool return]) +/* {{{ proto public static mixed Reflection::export(Reflector r [, bool return]) U Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection, export) { @@ -1330,7 +1330,7 @@ } /* }}} */ -/* {{{ proto public static array Reflection::getModifierNames(int modifiers) +/* {{{ proto public static array Reflection::getModifierNames(int modifiers) U Returns an array of modifier names */ ZEND_METHOD(reflection, getModifierNames) { @@ -1368,7 +1368,7 @@ } /* }}} */ -/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) +/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) U Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_function, export) { @@ -1376,7 +1376,7 @@ } /* }}} */ -/* {{{ proto public void ReflectionFunction::__construct(string name) +/* {{{ proto public void ReflectionFunction::__construct(string name) U Constructor. Throws an Exception in case the given function does not exist */ ZEND_METHOD(reflection_function, __construct) { @@ -1416,7 +1416,7 @@ } /* }}} */ -/* {{{ proto public string ReflectionFunction::__toString() +/* {{{ proto public string ReflectionFunction::__toString() U Returns a string representation */ ZEND_METHOD(reflection_function, __toString) { @@ -1428,11 +1428,11 @@ GET_REFLECTION_OBJECT_PTR(fptr); string_init(&str); _function_string(&str, fptr, intern->ce, "" TSRMLS_CC); - RETURN_RT_STRINGL(str.string, str.len - 1, ZSTR_AUTOFREE); + RETURN_U_STRINGL(ZEND_U_CONVERTER(UG(output_encoding_conv)), str.string, str.len - 1, ZSTR_AUTOFREE); } /* }}} */ -/* {{{ proto public string ReflectionFunction::getName() +/* {{{ proto public string ReflectionFunction::getName() U Returns this function's name */ ZEND_METHOD(reflection, function_getName) { @@ -1441,7 +1441,7 @@ } /* }}} */ -/* {{{ proto public bool ReflectionFunction::isInternal() +/* {{{ proto public bool ReflectionFunction::isInternal() U Returns whether this is an internal function */ ZEND_METHOD(reflection, function_isInternal) { @@ -1454,7 +1454,7 @@ } /* }}} */ -/* {{{ proto public bool ReflectionFunction::isUserDefined() +/* {{{ proto public bool ReflectionFunction::isUserDefined() U Returns whether this is an user-defined function */ ZEND_METHOD(reflection_function, isUserDefined) { @@ -1467,7 +1467,7 @@ } /* }}} */ -/* {{{ proto public bool ReflectionFunction::isDisabled() +/* {{{ proto public bool ReflectionFunction::isDisabled() U Returns whether this function has been disabled or not */ ZEND_METHOD(reflection_function, isDisabled) { @@ -1480,7 +1480,7 @@ } /* }}} */ -/* {{{ proto public string ReflectionFunction::getFileName() +/* {{{ proto public string ReflectionFunction::getFileName() U Returns the filename of the file this function was declared in */ ZEND_METHOD(reflection_function, getFileName) { @@ -1496,7 +1496,7 @@ } /* }}} */ -/* {{{ proto public int ReflectionFunction::getStartLine() +/* {{{ proto public int ReflectionFunction::getStartLine() U Returns the line this function's declaration starts at */ ZEND_METHOD(reflection_function, getStartLine) { @@ -1512,7 +1512,7 @@ } /* }}} */ -/* {{{ proto public int ReflectionFunction::getEndLine() +/* {{{ proto public int ReflectionFunction::getEndLine() U Returns the line this function's declaration ends at */ ZEND_METHOD(reflection_function, getEndLine) { @@ -1528,7 +1528,7 @@ } /* }}} */ -/* {{{ proto public string ReflectionFunction::getDocComment() +/* {{{ proto public string ReflectionFunction::getDocComment() U Returns the doc comment for this function */ ZEND_METHOD(reflection_function, getDocComment) { @@ -1538,13 +1538,17 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_fun
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
andrei Mon Oct 23 20:00:40 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Fix remaining Unicode issues. http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.263&r2=1.264&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.263 php-src/ext/reflection/php_reflection.c:1.264 --- php-src/ext/reflection/php_reflection.c:1.263 Wed Oct 18 16:34:25 2006 +++ php-src/ext/reflection/php_reflection.c Mon Oct 23 20:00:40 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.263 2006/10/18 16:34:25 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.264 2006/10/23 20:00:40 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2170,26 +2170,33 @@ zend_class_entry *ce; zend_function *mptr; zstr name_str; - char *tmp; + zstr tmp; int name_len, tmp_len; zval ztmp; zend_uchar type; - /* FIXME: Unicode support??? */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zt", &classname, &name_str, &name_len, &type) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &name_str, &name_len, &type) == FAILURE) { return; } - if ((tmp = strstr(name_str.s, "::")) == NULL) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %s", name_str); + if ((type == IS_UNICODE && (tmp.u = u_strstr(name_str.u, u_doublecolon)) == NULL) || + (type == IS_STRING && (tmp.s = strstr(name_str.s, "::")) == NULL)) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %R", type, name_str); return; } - type = IS_STRING; classname = &ztmp; - tmp_len = tmp - name_str.s; - ZVAL_STRINGL(classname, name_str.s, tmp_len, 1); + if (type == IS_UNICODE) { + tmp_len = tmp.u - name_str.u; + } else { + tmp_len = tmp.s - name_str.s; + } + ZVAL_ZSTRL(classname, name_str, tmp_len, type, 1); name_len = name_len - (tmp_len + 2); - name_str.s = tmp + 2; + if (type == IS_UNICODE) { + name_str.u = tmp.u + 2; + } else { + name_str.s = tmp.s + 2; + } } object = getThis(); @@ -3121,8 +3128,8 @@ zend_class_entry *ce, **pce; zend_property_info *property_info; zstr name, classname; - char *tmp; - int name_len, classname_len; + zstr tmp; + int name_len, classname_len, tmp_len; zend_uchar name_type; METHOD_NOTSTATIC(reflection_class_ptr); @@ -3131,17 +3138,28 @@ } GET_REFLECTION_OBJECT_PTR(ce); - if (zend_u_hash_find(&ce->properties_info, name_type, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { - reflection_property_factory(ce, property_info, return_value TSRMLS_CC); + if (zend_u_hash_find(&ce->properties_info, name_type, name, name_len + 1, (void**) &property_info) == SUCCESS) { + if ((property_info->flags & ZEND_ACC_SHADOW) == 0) { + reflection_property_factory(ce, property_info, return_value TSRMLS_CC); + } return; } - /* FIXME: Unicode support??? */ - if ((tmp = strstr(name.s, "::")) != NULL) { - classname_len = tmp - name.s; - classname.s = zend_str_tolower_dup(name.s, classname_len); - classname.s[classname_len] = '\0'; + if ((name_type == IS_UNICODE && (tmp.u = u_strstr(name.u, u_doublecolon)) != NULL) || + (name_type == IS_STRING && (tmp.s = strstr(name.s, "::")) != NULL)) { + + if (name_type == IS_UNICODE) { + classname_len = tmp.u - name.u; + } else { + classname_len = tmp.s - name.s; + } + classname = zend_u_str_case_fold(name_type, name, classname_len, 1, &tmp_len); + classname_len = tmp_len; name_len = name_len - (classname_len + 2); - name.s = tmp + 2; + if (name_type == IS_UNICODE) { + name.u = tmp.u + 2; + } else { + name.s = tmp.s + 2; + } if (zend_u_lookup_class(name_type, c
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 005.phpt 009.phpt 010.phpt 011.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.phpt 017.phpt 018.phpt 019.phpt 020.phpt 021.
dmitry Tue Oct 17 11:11:45 2006 UTC Added files: /php-src/ext/reflection/tests 010.phpt 011.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.phpt 017.phpt 018.phpt 019.phpt 020.phpt 021.phpt 022.phpt 023.phpt 024.phpt Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests 005.phpt 009.phpt Log: Unicode support. (Two more places must be fixed. Look for FIXME comments.) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.261&r2=1.262&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.261 php-src/ext/reflection/php_reflection.c:1.262 --- php-src/ext/reflection/php_reflection.c:1.261 Wed Oct 11 15:51:17 2006 +++ php-src/ext/reflection/php_reflection.c Tue Oct 17 11:11:45 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.261 2006/10/11 15:51:17 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.262 2006/10/17 11:11:45 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -200,7 +200,7 @@ { zval **value; - if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) { + if (zend_ascii_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) { RETURN_FALSE; } @@ -276,9 +276,9 @@ return object; } -static void _const_string(string *str, char *name, zval *value, char *indent TSRMLS_DC); +static void _const_string(string *str, zstr name, zval *value, char *indent TSRMLS_DC); static void _function_string(string *str, zend_function *fptr, zend_class_entry *scope, char *indent TSRMLS_DC); -static void _property_string(string *str, zend_property_info *prop, char *prop_name, char* indent TSRMLS_DC); +static void _property_string(string *str, zend_property_info *prop, zstr prop_name, char* indent TSRMLS_DC); static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *indent TSRMLS_DC); static void _extension_string(string *str, zend_module_entry *module, char *indent TSRMLS_DC); @@ -360,7 +360,7 @@ while (zend_hash_get_current_data_ex(&ce->constants_table, (void **) &value, &pos) == SUCCESS) { zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_len, &num_index, 0, &pos); - _const_string(str, key.s, *value, indent TSRMLS_CC); + _const_string(str, key, *value, indent TSRMLS_CC); zend_hash_move_forward_ex(&ce->constants_table, &pos); } } @@ -397,7 +397,7 @@ while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) { if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) { - _property_string(str, prop, NULL, sub_indent.string TSRMLS_CC); + _property_string(str, prop, NULL_ZSTR, sub_indent.string TSRMLS_CC); } zend_hash_move_forward_ex(&ce->properties_info, &pos); @@ -457,7 +457,7 @@ while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) { if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) { - _property_string(str, prop, NULL, sub_indent.string TSRMLS_CC); + _property_string(str, prop, NULL_ZSTR, sub_indent.string TSRMLS_CC); } zend_hash_move_forward_ex(&ce->properties_info, &pos); } @@ -479,16 +479,17 @@ while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { zstr prop_name; uint prop_name_size; + zend_uchar prop_type; ulong index; - if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { - if (prop_name_size && prop_name.s[0]) { /* skip all private and protected properties */ - if (!zend_hash_quick_exists(&ce->properties_info, prop_name.s, prop_name_size, zend_get_hash_value(prop_name.s, prop_name_size))) { + if ((prop_type = zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 0, &pos)) == (UG(unicode)?HASH_KE
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests 009.phpt bug39067.phpt
tony2001Wed Oct 11 15:51:17 2006 UTC Added files: /php-src/ext/reflection/tests 009.phpt Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug39067.phpt Log: fix #39125 (Memleak when reflecting non-existing class/method) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.260&r2=1.261&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.260 php-src/ext/reflection/php_reflection.c:1.261 --- php-src/ext/reflection/php_reflection.c:1.260 Fri Oct 6 18:02:50 2006 +++ php-src/ext/reflection/php_reflection.c Wed Oct 11 15:51:17 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.261 2006/10/11 15:51:17 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2180,6 +2180,7 @@ } /* FIXME: Unicode support??? */ if ((tmp = strstr(name_str.s, "::")) == NULL) { + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %s", name_str); return; } type = IS_STRING; @@ -2203,6 +2204,9 @@ if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", Z_UNIVAL_P(classname)); + if (classname == &ztmp) { + zval_dtor(&ztmp); + } return; } ce = *pce; @@ -2213,6 +2217,9 @@ break; default: + if (classname == &ztmp) { + zval_dtor(&ztmp); + } _DO_THROW("The parameter class is expected to be either a string or an object"); /* returns out of this function */ } @@ -4913,7 +4920,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.261 2006/10/11 15:51:17 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39067.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug39067.phpt diff -u php-src/ext/reflection/tests/bug39067.phpt:1.2 php-src/ext/reflection/tests/bug39067.phpt:1.3 --- php-src/ext/reflection/tests/bug39067.phpt:1.2 Fri Oct 6 18:02:50 2006 +++ php-src/ext/reflection/tests/bug39067.phpt Wed Oct 11 15:51:17 2006 @@ -47,5 +47,5 @@ unicode(1) "C" unicode(1) "B" unicode(1) "A" -unicode(4) "Test2" +unicode(5) "Test2" Done http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/009.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/009.phpt +++ php-src/ext/reflection/tests/009.phpt --TEST-- ReflectionMethod::__construct() tests --FILE-- getMessage()); } } $a = array("", 1, ""); $b = array("", "", 1); foreach ($a as $key=>$val) { try { new ReflectionMethod($val, $b[$key]); } catch (Exception $e) { var_dump($e->getMessage()); } } echo "Done\n"; ?> --EXPECTF-- string(20) "Invalid method name " string(21) "Invalid method name 1" string(21) "Class does not exist" string(22) "Class a does not exist" string(21) "Class does not exist" string(22) "Class a does not exist" string(21) "Class does not exist" string(66) "The parameter class is expected to be either a string or an object" string(21) "Class does not exist" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39067.phpt
Hi Andrei, most parts off it work in unicode mode, there are a few places which need little work, see Dmitry's "FIXME: Unicode support" comments to get an idea. Basically I'm in writing tests and writing a patch but currently have less time than expected... johannes Andrei Zmievski wrote: Any idea if ext/reflection is Unicode-ready or how much work it needs to get there? -Andrei On Oct 6, 2006, at 11:02 AM, Antony Dovgal wrote: tony2001Fri Oct 6 18:02:51 2006 UTC Modified files: /php-src/ext/reflectionphp_reflection.c /php-src/ext/reflection/testsbug39067.phpt Log: more improvements http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.259&r2=1.260&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.259 php-src/ext/reflection/php_reflection.c:1.260 --- php-src/ext/reflection/php_reflection.c:1.259Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/php_reflection.cFri Oct 6 18:02:50 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4099,12 +4099,12 @@ prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { -ce = tmp_ce; -tmp_ce = tmp_ce->parent; if (tmp_info->flags & ZEND_ACC_PRIVATE) { /* it's a private property, so it can't be inherited */ break; } +ce = tmp_ce; +tmp_ce = tmp_ce->parent; } zend_reflection_class_factory(ce, return_value TSRMLS_CC); @@ -4913,7 +4913,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); -php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $"); +php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39067.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug39067.phpt diff -u php-src/ext/reflection/tests/bug39067.phpt:1.1 php-src/ext/reflection/tests/bug39067.phpt:1.2 --- php-src/ext/reflection/tests/bug39067.phpt:1.1Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/tests/bug39067.phptFri Oct 6 18:02:50 2006 @@ -24,15 +24,28 @@ $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); +class Test { +private $x; +} + +class Test2 extends Test { +public $x; +} + +$rc = new ReflectionClass('Test2'); +var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); + echo "Done\n"; ?> --EXPECTF-- string(1) "C" string(1) "B" string(1) "A" +string(5) "Test2" Done --UEXPECTF-- unicode(1) "C" unicode(1) "B" unicode(1) "A" +unicode(4) "Test2" Done --PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39067.phpt
On 10/06/2006 10:14 PM, Andrei Zmievski wrote: Any idea if ext/reflection is Unicode-ready or how much work it needs to get there? I don't think it should be something complex, but no it's not ready yet. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39067.phpt
Any idea if ext/reflection is Unicode-ready or how much work it needs to get there? -Andrei On Oct 6, 2006, at 11:02 AM, Antony Dovgal wrote: tony2001Fri Oct 6 18:02:51 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug39067.phpt Log: more improvements http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c? r1=1.259&r2=1.260&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.259 php-src/ext/reflection/php_reflection.c:1.260 --- php-src/ext/reflection/php_reflection.c:1.259 Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/php_reflection.c Fri Oct 6 18:02:50 2006 @@ -20,7 +20,7 @@ +-- + */ -/* $Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4099,12 +4099,12 @@ prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { - ce = tmp_ce; - tmp_ce = tmp_ce->parent; if (tmp_info->flags & ZEND_ACC_PRIVATE) { /* it's a private property, so it can't be inherited */ break; } + ce = tmp_ce; + tmp_ce = tmp_ce->parent; } zend_reflection_class_factory(ce, return_value TSRMLS_CC); @@ -4913,7 +4913,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/ bug39067.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug39067.phpt diff -u php-src/ext/reflection/tests/bug39067.phpt:1.1 php-src/ext/reflection/tests/bug39067.phpt:1.2 --- php-src/ext/reflection/tests/bug39067.phpt:1.1 Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/tests/bug39067.phpt Fri Oct 6 18:02:50 2006 @@ -24,15 +24,28 @@ $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); +class Test { + private $x; +} + +class Test2 extends Test { + public $x; +} + +$rc = new ReflectionClass('Test2'); +var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); + echo "Done\n"; ?> --EXPECTF-- string(1) "C" string(1) "B" string(1) "A" +string(5) "Test2" Done --UEXPECTF-- unicode(1) "C" unicode(1) "B" unicode(1) "A" +unicode(4) "Test2" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39067.phpt
tony2001Fri Oct 6 18:02:51 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug39067.phpt Log: more improvements http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.259&r2=1.260&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.259 php-src/ext/reflection/php_reflection.c:1.260 --- php-src/ext/reflection/php_reflection.c:1.259 Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/php_reflection.c Fri Oct 6 18:02:50 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4099,12 +4099,12 @@ prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { - ce = tmp_ce; - tmp_ce = tmp_ce->parent; if (tmp_info->flags & ZEND_ACC_PRIVATE) { /* it's a private property, so it can't be inherited */ break; } + ce = tmp_ce; + tmp_ce = tmp_ce->parent; } zend_reflection_class_factory(ce, return_value TSRMLS_CC); @@ -4913,7 +4913,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.260 2006/10/06 18:02:50 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39067.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug39067.phpt diff -u php-src/ext/reflection/tests/bug39067.phpt:1.1 php-src/ext/reflection/tests/bug39067.phpt:1.2 --- php-src/ext/reflection/tests/bug39067.phpt:1.1 Fri Oct 6 17:34:56 2006 +++ php-src/ext/reflection/tests/bug39067.phpt Fri Oct 6 18:02:50 2006 @@ -24,15 +24,28 @@ $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); +class Test { + private $x; +} + +class Test2 extends Test { + public $x; +} + +$rc = new ReflectionClass('Test2'); +var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); + echo "Done\n"; ?> --EXPECTF-- string(1) "C" string(1) "B" string(1) "A" +string(5) "Test2" Done --UEXPECTF-- unicode(1) "C" unicode(1) "B" unicode(1) "A" +unicode(4) "Test2" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39067.phpt
tony2001Fri Oct 6 17:34:57 2006 UTC Added files: /php-src/ext/reflection/tests bug39067.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: fix #39067 (getDeclaringClass() and private properties) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.258&r2=1.259&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.258 php-src/ext/reflection/php_reflection.c:1.259 --- php-src/ext/reflection/php_reflection.c:1.258 Tue Oct 3 09:59:24 2006 +++ php-src/ext/reflection/php_reflection.c Fri Oct 6 17:34:56 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.258 2006/10/03 09:59:24 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4101,6 +4101,10 @@ while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { ce = tmp_ce; tmp_ce = tmp_ce->parent; + if (tmp_info->flags & ZEND_ACC_PRIVATE) { + /* it's a private property, so it can't be inherited */ + break; + } } zend_reflection_class_factory(ce, return_value TSRMLS_CC); @@ -4909,7 +4913,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.258 2006/10/03 09:59:24 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.259 2006/10/06 17:34:56 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39067.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug39067.phpt +++ php-src/ext/reflection/tests/bug39067.phpt --TEST-- Bug #39067 (getDeclaringClass() and private properties) --FILE-- getProperty('x')->getDeclaringClass()->getName()); $rc = new ReflectionClass('B'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); $rc = new ReflectionClass('A'); var_dump($rc->getProperty('x')->getDeclaringClass()->getName()); echo "Done\n"; ?> --EXPECTF-- string(1) "C" string(1) "B" string(1) "A" Done --UEXPECTF-- unicode(1) "C" unicode(1) "B" unicode(1) "A" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
dmitry Tue Oct 3 09:59:24 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Fixed bug #38942 (Double old-style-ctor inheritance) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.257&r2=1.258&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.257 php-src/ext/reflection/php_reflection.c:1.258 --- php-src/ext/reflection/php_reflection.c:1.257 Mon Oct 2 12:15:47 2006 +++ php-src/ext/reflection/php_reflection.c Tue Oct 3 09:59:24 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.257 2006/10/02 12:15:47 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.258 2006/10/03 09:59:24 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -502,11 +502,13 @@ /* Non static methods */ if (&ce->function_table) { count = zend_hash_num_elements(&ce->function_table) - count_static_funcs; - string_printf(str, "\n%s - Methods [%d] {", indent, count); if (count > 0) { HashPosition pos; zend_function *mptr; + string dyn; + count = 0; + string_init(&dyn); zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { @@ -524,14 +526,18 @@ (zend_u_binary_strcasecmp(key.u, key_len-1, mptr->common.function_name.u, len) == 0) : (zend_binary_strcasecmp(key.s, key_len-1, mptr->common.function_name.s, len) == 0))) { - string_printf(str, "\n"); - _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); + string_printf(&dyn, "\n"); + _function_string(&dyn, mptr, ce, sub_indent.string TSRMLS_CC); + count++; } } zend_hash_move_forward_ex(&ce->function_table, &pos); } + string_printf(str, "\n%s - Methods [%d] {", indent, count); + string_append(str, &dyn); + string_free(&dyn); } else { - string_printf(str, "\n"); + string_printf(str, "\n%s - Methods [0] {\n", indent); } string_printf(str, "%s }\n", indent); } @@ -4903,7 +4909,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.257 2006/10/02 12:15:47 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.258 2006/10/03 09:59:24 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug39001.phpt
tony2001Mon Oct 2 12:15:47 2006 UTC Added files: /php-src/ext/reflection/tests bug39001.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: fix #39001 (ReflectionProperty returns incorrect declaring class for protected properties) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.256&r2=1.257&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.256 php-src/ext/reflection/php_reflection.c:1.257 --- php-src/ext/reflection/php_reflection.c:1.256 Tue Sep 26 07:55:54 2006 +++ php-src/ext/reflection/php_reflection.c Mon Oct 2 12:15:47 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.256 2006/09/26 07:55:54 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.257 2006/10/02 12:15:47 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4080,12 +4080,19 @@ property_reference *ref; zend_class_entry *tmp_ce, *ce; zend_property_info *tmp_info; + zstr prop_name, class_name; + int prop_name_len; METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); + if (zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, ref->prop->name, ref->prop->name_length, &class_name, &prop_name) != SUCCESS) { + RETURN_FALSE; + } + + prop_name_len = USTR_LEN(prop_name); ce = tmp_ce = ref->ce; - while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, ref->prop->name, ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) { + while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) { ce = tmp_ce; tmp_ce = tmp_ce->parent; } @@ -4896,7 +4903,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.256 2006/09/26 07:55:54 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.257 2006/10/02 12:15:47 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug39001.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug39001.phpt +++ php-src/ext/reflection/tests/bug39001.phpt --TEST-- Bug #39001 (ReflectionProperty returns incorrect declaring class for protected properties) --FILE-- getProperty('publicVar')->getDeclaringClass()->getName()); var_dump($r->getProperty('protectedVar')->getDeclaringClass()->getName()); echo "Done\n"; ?> --EXPECTF-- string(7) "CParent" string(7) "CParent" Done --UEXPECTF-- unicode(7) "CParent" unicode(7) "CParent" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38942.phpt
Ops. Thank you for catching this. Dmitry. > -Original Message- > From: Hannes Magnusson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 26, 2006 12:07 PM > To: Dmitry Stogov > Cc: php-cvs@lists.php.net > Subject: Re: [PHP-CVS] cvs: php-src /ext/reflection > php_reflection.c /ext/reflection/tests bug38942.phpt > > > Hi Dmitry > > On 9/26/06, Dmitry Stogov <[EMAIL PROTECTED]> wrote: > > dmitry Tue Sep 26 07:55:54 2006 UTC > > > > Modified files: > > /php-src/ext/reflection php_reflection.c > > /php-src/ext/reflection/tests bug38942.phpt > > Log: > > Fixed bug #38942 (Double old-style-ctor inheritance) > > > [snip] > > + - Methods [2] { > > This isn't really what I expected. Still marked as 2 methods > > > +Method [ public method foo ] { > > + @@ %sbug38942.php 3 - 3 > > +} > > + } > > +} > > > > > -Hannes > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38942.phpt
Hi Dmitry On 9/26/06, Dmitry Stogov <[EMAIL PROTECTED]> wrote: dmitry Tue Sep 26 07:55:54 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug38942.phpt Log: Fixed bug #38942 (Double old-style-ctor inheritance) [snip] + - Methods [2] { This isn't really what I expected. Still marked as 2 methods +Method [ public method foo ] { + @@ %sbug38942.php 3 - 3 +} + } +} -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38942.phpt
dmitry Tue Sep 26 07:55:54 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug38942.phpt Log: Fixed bug #38942 (Double old-style-ctor inheritance) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.255&r2=1.256&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.255 php-src/ext/reflection/php_reflection.c:1.256 --- php-src/ext/reflection/php_reflection.c:1.255 Sun Sep 17 09:39:04 2006 +++ php-src/ext/reflection/php_reflection.c Tue Sep 26 07:55:54 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.255 2006/09/17 09:39:04 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.256 2006/09/26 07:55:54 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -511,8 +511,22 @@ while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { if (!(mptr->common.fn_flags & ZEND_ACC_STATIC)) { - string_printf(str, "\n"); - _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); + zstr key; + uint key_len; + ulong num_index; + uint len = UG(unicode)?u_strlen(mptr->common.function_name.u):strlen(mptr->common.function_name.s); + + /* Do not display old-style inherited constructors */ + if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || + mptr->common.scope == ce || + zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING) || + (UG(unicode) ? +(zend_u_binary_strcasecmp(key.u, key_len-1, mptr->common.function_name.u, len) == 0) : +(zend_binary_strcasecmp(key.s, key_len-1, mptr->common.function_name.s, len) == 0))) { + + string_printf(str, "\n"); + _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC); + } } zend_hash_move_forward_ex(&ce->function_table, &pos); } @@ -4882,7 +4896,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.255 2006/09/17 09:39:04 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.256 2006/09/26 07:55:54 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38942.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug38942.phpt diff -u /dev/null php-src/ext/reflection/tests/bug38942.phpt:1.2 --- /dev/null Tue Sep 26 07:55:54 2006 +++ php-src/ext/reflection/tests/bug38942.phpt Tue Sep 26 07:55:54 2006 @@ -0,0 +1,34 @@ +--TEST-- +Bug #38942 (Double old-style-ctor inheritance) +--FILE-- + +--EXPECTF-- +Class [ class bar extends foo ] { + @@ %sbug38942.php 6-7 + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { +Method [ public method foo ] { + @@ %sbug38942.php 3 - 3 +} + } +} -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
johannesSun Sep 17 09:39:04 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Unicode fix http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.254&r2=1.255&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.254 php-src/ext/reflection/php_reflection.c:1.255 --- php-src/ext/reflection/php_reflection.c:1.254 Mon Sep 11 21:21:27 2006 +++ php-src/ext/reflection/php_reflection.c Sun Sep 17 09:39:04 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.254 2006/09/11 21:21:27 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.255 2006/09/17 09:39:04 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3532,8 +3532,7 @@ zval *interface; ALLOC_ZVAL(interface); zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC); - /* FIXME: Unicode support??? */ - add_assoc_zval_ex(return_value, ce->interfaces[i]->name.s, ce->interfaces[i]->name_length + 1, interface); + add_u_assoc_zval_ex(return_value, UG(unicode)?IS_UNICODE:IS_STRING, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface); } } } @@ -4883,7 +4882,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.254 2006/09/11 21:21:27 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.255 2006/09/17 09:39:04 johannes Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
johannesMon Sep 11 21:21:28 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Print the type of the original value http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.253&r2=1.254&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.253 php-src/ext/reflection/php_reflection.c:1.254 --- php-src/ext/reflection/php_reflection.c:1.253 Mon Sep 11 17:06:59 2006 +++ php-src/ext/reflection/php_reflection.c Mon Sep 11 21:21:27 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.253 2006/09/11 17:06:59 johannes Exp $ */ +/* $Id: php_reflection.c,v 1.254 2006/09/11 21:21:27 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -530,9 +530,12 @@ /* {{{ _const_string */ static void _const_string(string *str, char *name, zval *value, char *indent TSRMLS_DC) { + char *type; zval value_copy; int use_copy; + type = zend_zval_type_name(value); + zend_make_printable_zval(value, &value_copy, &use_copy); if (use_copy) { value = &value_copy; @@ -540,7 +543,7 @@ string_printf(str, "%sConstant [ %s %v ] { %s }\n", indent, - zend_zval_type_name(value), + type, name, Z_STRVAL_P(value)); @@ -4880,7 +4883,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.253 2006/09/11 17:06:59 johannes Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.254 2006/09/11 21:21:27 johannes Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
johannesMon Sep 11 17:06:59 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fix #37923 (Display constant value in reflection::export) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.252&r2=1.253&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.252 php-src/ext/reflection/php_reflection.c:1.253 --- php-src/ext/reflection/php_reflection.c:1.252 Sun Sep 10 13:35:32 2006 +++ php-src/ext/reflection/php_reflection.c Mon Sep 11 17:06:59 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.252 2006/09/10 13:35:32 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.253 2006/09/11 17:06:59 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -530,10 +530,23 @@ /* {{{ _const_string */ static void _const_string(string *str, char *name, zval *value, char *indent TSRMLS_DC) { - string_printf(str, "%sConstant [ %s %v ] { }\n", + zval value_copy; + int use_copy; + + zend_make_printable_zval(value, &value_copy, &use_copy); + if (use_copy) { + value = &value_copy; + } + + string_printf(str, "%sConstant [ %s %v ] { %s }\n", indent, zend_zval_type_name(value), - name); + name, + Z_STRVAL_P(value)); + + if (use_copy) { + zval_dtor(value); + } } /* }}} */ @@ -4867,7 +4880,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.252 2006/09/10 13:35:32 bjori Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.253 2006/09/11 17:06:59 johannes Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Sun Sep 10 13:35:33 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: abstracting ReflectionFunctionAbstract & fix couple of typos http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.251&r2=1.252&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.251 php-src/ext/reflection/php_reflection.c:1.252 --- php-src/ext/reflection/php_reflection.c:1.251 Thu Aug 31 16:14:43 2006 +++ php-src/ext/reflection/php_reflection.c Sun Sep 10 13:35:32 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.251 2006/08/31 16:14:43 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.252 2006/09/10 13:35:32 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1119,7 +1119,7 @@ zend_u_unmangle_property_name(utype, prop->name, prop->name_length, &class_name, &prop_name); if (!(prop->flags & ZEND_ACC_PRIVATE)) { - /* we have to seach the class hierarchy for this (implicit) public or protected property */ + /* we have to search the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce; zend_property_info *tmp_info; int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); @@ -3783,7 +3783,7 @@ } if (!(property_info->flags & ZEND_ACC_PRIVATE)) { - /* we have to seach the class hierarchy for this (implicit) public or protected property */ + /* we have to search the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce; zend_property_info *tmp_info; @@ -4424,8 +4424,7 @@ static zend_function_entry reflection_function_abstract_functions[] = { ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0) - ZEND_ME(reflection_function, __toString, NULL, 0) + PHP_ABSTRACT_ME(reflection_function, __toString, NULL) ZEND_ME(reflection_function, isInternal, NULL, 0) ZEND_ME(reflection_function, isUserDefined, NULL, 0) ZEND_ME(reflection_function, getName, NULL, 0) @@ -4445,6 +,8 @@ }; static zend_function_entry reflection_function_functions[] = { + ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0) + ZEND_ME(reflection_function, __toString, NULL, 0) ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_function, isDisabled, NULL, 0) ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0) @@ -4533,7 +4534,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0) - ZEND_ARG_INFO(0, $filter) + ZEND_ARG_INFO(0, filter) ZEND_END_ARG_INFO() static @@ -4866,7 +4867,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.251 2006/08/31 16:14:43 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.252 2006/09/10 13:35:32 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38653.phpt
tony2001Wed Aug 30 10:41:43 2006 UTC Added files: /php-src/ext/reflection/tests bug38653.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: fix #38653 (memory leak in ReflectionClass::getConstant()) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.249&r2=1.250&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.249 php-src/ext/reflection/php_reflection.c:1.250 --- php-src/ext/reflection/php_reflection.c:1.249 Thu Jul 27 09:19:25 2006 +++ php-src/ext/reflection/php_reflection.c Wed Aug 30 10:41:43 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.250 2006/08/30 10:41:43 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -206,6 +206,7 @@ *return_value = **value; zval_copy_ctor(return_value); + INIT_PZVAL(return_value); } static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC) @@ -3261,6 +3262,7 @@ } *return_value = **value; zval_copy_ctor(return_value); + INIT_PZVAL(return_value); } /* }}} */ @@ -4865,7 +4867,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.250 2006/08/30 10:41:43 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38653.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug38653.phpt +++ php-src/ext/reflection/tests/bug38653.phpt --TEST-- Bug #38653 (memory leak in ReflectionClass::getConstant()) --FILE-- getConstant("cons")); var_dump($foo->getConstant("cons1")); var_dump($foo->getConstant("cons2")); var_dump($foo->getConstant("no such const")); echo "Done\n"; ?> --EXPECTF-- int(10) string(0) "" string(4) "test" bool(false) Done --UEXPECTF-- int(10) unicode(0) "" unicode(4) "test" bool(false) Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38132.phpt
dmitry Thu Jul 27 09:19:26 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug38132.phpt Log: Fix usage of uninitialized value and unicode support http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.248&r2=1.249&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.248 php-src/ext/reflection/php_reflection.c:1.249 --- php-src/ext/reflection/php_reflection.c:1.248 Thu Jul 27 00:22:07 2006 +++ php-src/ext/reflection/php_reflection.c Thu Jul 27 09:19:25 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $ */ +/* $Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2645,8 +2645,8 @@ { reflection_object *intern; zend_class_entry *ce; -HashPosition pos; -zval **value; + HashPosition pos; + zval **value; METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); @@ -2663,13 +2663,14 @@ if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE) { zstr prop_name, class_name; - int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + int prop_name_len; zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); + prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); zval_add_ref(value); - zend_u_hash_update(Z_ARRVAL_P(return_value), UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value, sizeof(zval *), NULL); + zend_u_hash_update(Z_ARRVAL_P(return_value), UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len+1, value, sizeof(zval *), NULL); } zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos); } @@ -4864,7 +4865,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38132.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug38132.phpt diff -u php-src/ext/reflection/tests/bug38132.phpt:1.2 php-src/ext/reflection/tests/bug38132.phpt:1.3 --- php-src/ext/reflection/tests/bug38132.phpt:1.2 Wed Jul 26 23:32:07 2006 +++ php-src/ext/reflection/tests/bug38132.phpt Thu Jul 27 09:19:26 2006 @@ -32,3 +32,19 @@ bool(false) bool(false) bool(true) +--UEXPECT-- +array(2) { + [u"bar"]=> + unicode(3) "baz" + [u"a"]=> + unicode(1) "a" +} +array(2) { + [0]=> + unicode(3) "bar" + [1]=> + unicode(1) "a" +} +bool(false) +bool(false) +bool(true) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
iliaa Thu Jul 27 00:22:07 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: MFB: Improved fix for bug #38132 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.247&r2=1.248&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.247 php-src/ext/reflection/php_reflection.c:1.248 --- php-src/ext/reflection/php_reflection.c:1.247 Wed Jul 26 08:06:59 2006 +++ php-src/ext/reflection/php_reflection.c Thu Jul 27 00:22:07 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2643,9 +2643,10 @@ Returns an associative array containing all static property values of the class */ ZEND_METHOD(reflection_class, getStaticProperties) { - zval *tmp_copy; reflection_object *intern; zend_class_entry *ce; +HashPosition pos; +zval **value; METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); @@ -2653,7 +2654,25 @@ zend_update_class_constants(ce TSRMLS_CC); array_init(return_value); - zend_hash_copy(Z_ARRVAL_P(return_value), CE_STATIC_MEMBERS(ce), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + zend_hash_internal_pointer_reset_ex(CE_STATIC_MEMBERS(ce), &pos); + + while (zend_hash_get_current_data_ex(CE_STATIC_MEMBERS(ce), (void **) &value, &pos) == SUCCESS) { + uint key_len; + zstr key; + ulong num_index; + + if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE) { + zstr prop_name, class_name; + int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); + + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); + + zval_add_ref(value); + + zend_u_hash_update(Z_ARRVAL_P(return_value), UG(unicode)?IS_UNICODE:IS_STRING, prop_name, prop_name_len, value, sizeof(zval *), NULL); + } + zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos); + } } /* }}} */ @@ -4845,7 +4864,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.248 2006/07/27 00:22:07 iliaa Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38217.phpt
tony2001Wed Jul 26 08:06:59 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/reflection/tests bug38217.phpt Log: fix bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.246&r2=1.247&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.246 php-src/ext/reflection/php_reflection.c:1.247 --- php-src/ext/reflection/php_reflection.c:1.246 Tue Jul 25 12:36:29 2006 +++ php-src/ext/reflection/php_reflection.c Wed Jul 26 08:06:59 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.246 2006/07/25 12:36:29 iliaa Exp $ */ +/* $Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3405,7 +3405,7 @@ zval *retval_ptr; reflection_object *intern; zend_class_entry *ce; - int argc; + int argc = 0; HashTable *args; @@ -3415,11 +3415,13 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h", &args) == FAILURE) { return; } - argc = args->nNumOfElements; + if (ZEND_NUM_ARGS() > 0) { + argc = args->nNumOfElements; + } /* Run the constructor if there is one */ if (ce->constructor) { - zval ***params; + zval ***params = NULL; zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -3427,10 +3429,12 @@ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); return; } - - params = safe_emalloc(sizeof(zval **), argc, 0); - zend_hash_apply_with_argument(args, (apply_func_arg_t)_zval_array_to_c_array, ¶ms TSRMLS_CC); - params -= argc; + + if (argc) { + params = safe_emalloc(sizeof(zval **), argc, 0); + zend_hash_apply_with_argument(args, (apply_func_arg_t)_zval_array_to_c_array, ¶ms TSRMLS_CC); + params -= argc; + } object_init_ex(return_value, ce); @@ -3450,7 +3454,9 @@ fcc.object_pp = &return_value; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - efree(params); + if (params) { + efree(params); + } zval_ptr_dtor(&retval_ptr); zend_error(E_WARNING, "Invocation of %v's constructor failed", ce->name); RETURN_NULL(); @@ -3458,7 +3464,9 @@ if (retval_ptr) { zval_ptr_dtor(&retval_ptr); } - efree(params); + if (params) { + efree(params); + } } else if (!ZEND_NUM_ARGS()) { object_init_ex(return_value, ce); } else { @@ -4837,7 +4845,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.246 2006/07/25 12:36:29 iliaa Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.247 2006/07/26 08:06:59 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38217.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug38217.phpt diff -u /dev/null php-src/ext/reflection/tests/bug38217.phpt:1.2 --- /dev/null Wed Jul 26 08:06:59 2006 +++ php-src/ext/reflection/tests/bug38217.phpt Wed Jul 26 08:06:59 2006 @@ -0,0 +1,54 @@ +--TEST-- +#38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory) +--FILE-- +newInstanceArgs()); + +class Object1 { + public function __construct($var) { + var_dump($var); + } +} + +$class= new ReflectionClass('Object1'); +var_dump($class->newInstanceArgs()); +var_dump($class->newInstanceArgs(array('test'))); + + +echo "Done\n"; +?> +--EXPECTF-- +object(Object)#%d (0) { +} + +Warning: Missing argument 1 for Object1::__construct() in %s on line %d + +Notice: Undefined variable: var in %s on line %d +NULL +object(Object1)#%d (0) { +} +string(4) "test" +object(Object1)#%d (0) { +} +Done +--UEXPECTF-- +object(Object)#%d (0) { +} + +Warning: Missing argument 1 for Object1::__construct() in %s on line %d + +Notice: Undefined variable: var in %s on line %d +NULL +object(Object1)#%d (0) { +} +unicode(4) "test" +object(Object1)#%d (0) { +} +Done -- PHP CVS M
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38194.phpt
iliaa Tue Jul 25 12:36:29 2006 UTC Modified files: /php-src/ext/reflection/tests bug38194.phpt /php-src/ext/reflection php_reflection.c Log: MFB: Fixed bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the class itself). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38194.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug38194.phpt diff -u /dev/null php-src/ext/reflection/tests/bug38194.phpt:1.2 --- /dev/null Tue Jul 25 12:36:29 2006 +++ php-src/ext/reflection/tests/bug38194.phpt Tue Jul 25 12:36:29 2006 @@ -0,0 +1,13 @@ +--TEST-- +Reflection Bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the class itself) +--SKIPIF-- + +--FILE-- +isSubclassOf($objectClass)); +?> +--EXPECT-- +bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.245&r2=1.246&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.245 php-src/ext/reflection/php_reflection.c:1.246 --- php-src/ext/reflection/php_reflection.c:1.245 Mon Jul 24 17:55:41 2006 +++ php-src/ext/reflection/php_reflection.c Tue Jul 25 12:36:29 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.245 2006/07/24 17:55:41 helly Exp $ */ +/* $Id: php_reflection.c,v 1.246 2006/07/25 12:36:29 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3574,8 +3574,7 @@ return; } - - RETURN_BOOL(instanceof_function(ce, class_ce TSRMLS_CC)); + RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce TSRMLS_CC))); } /* }}} */ @@ -4838,7 +4837,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.245 2006/07/24 17:55:41 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.246 2006/07/25 12:36:29 iliaa Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/soap php_encoding.c /ext/standard http.c var.c /ext/wddx wddx.c
helly Mon Jul 24 17:55:42 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c /php-src/ext/soap php_encoding.c /php-src/ext/standard http.c var.c /php-src/ext/wddx wddx.c Log: - zend_(u_)_unmangle_property_name() has changed http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.244&r2=1.245&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.244 php-src/ext/reflection/php_reflection.c:1.245 --- php-src/ext/reflection/php_reflection.c:1.244 Tue Jul 18 17:52:45 2006 +++ php-src/ext/reflection/php_reflection.c Mon Jul 24 17:55:41 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.244 2006/07/18 17:52:45 andrei Exp $ */ +/* $Id: php_reflection.c,v 1.245 2006/07/24 17:55:41 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -791,7 +791,7 @@ string_printf(str, "static "); } - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, prop->name, &class_name, &prop_name); + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, prop->name, prop->name_length, &class_name, &prop_name); string_printf(str, "$%v", prop_name); } @@ -1115,7 +1115,7 @@ zstr class_name, prop_name; zend_uchar utype = UG(unicode) ? IS_UNICODE : IS_STRING; - zend_u_unmangle_property_name(utype, prop->name, &class_name, &prop_name); + zend_u_unmangle_property_name(utype, prop->name, prop->name_length, &class_name, &prop_name); if (!(prop->flags & ZEND_ACC_PRIVATE)) { /* we have to seach the class hierarchy for this (implicit) public or protected property */ @@ -2755,7 +2755,7 @@ zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(&ce->default_properties, &pos); - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, &class_name, &prop_name); + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, key_len-1, &class_name, &prop_name); /* FIXME: Unicode support??? */ if (class_name.s && class_name.s[0] != '*' && strcmp(class_name.s, ce->name.s)) { /* filter privates from base classes */ @@ -3770,7 +3770,7 @@ ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL); - zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, &class_name, &prop_name); + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, property_info->name, property_info->name_length, &class_name, &prop_name); MAKE_STD_ZVAL(propname); ZVAL_TEXT(propname, prop_name, 1); zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL); @@ -4838,7 +4838,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.244 2006/07/18 17:52:45 andrei Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.245 2006/07/24 17:55:41 helly Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.137&r2=1.138&diff_format=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.137 php-src/ext/soap/php_encoding.c:1.138 --- php-src/ext/soap/php_encoding.c:1.137 Tue Jul 18 15:05:07 2006 +++ php-src/ext/soap/php_encoding.c Mon Jul 24 17:55:41 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_encoding.c,v 1.137 2006/07/18 15:05:07 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.138 2006/07/24 17:55:41 helly Exp $ */ #include @@ -1844,7 +1844,7 @@ if (Z_TYPE_P(data) == IS_OBJECT) { char *class_name; - zend_unmangle_property_name(key.s, &class_name, &prop_name); + zend_unmangle_property_name(key.s, key_len-1, &class_name, &prop_name); } else { prop_name = key.s; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http.c?r1=1.21&r2=1.22&diff_
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c ZendEngine2 zend_API.c zend_builtin_functions.c zend_compile.h zend_execute.c zend_execute.h zend_execute_API.c zend_language_scanner.l zend_op
andrei Tue Jul 18 17:52:45 2006 UTC Modified files: /ZendEngine2zend_API.c zend_builtin_functions.c zend_compile.h zend_execute.c zend_execute.h zend_execute_API.c zend_language_scanner.l zend_operators.c zend_unicode.c /php-src/ext/reflection php_reflection.c Log: Callable checks and class fetching and lookup should support identifer normalization now. (Marcus, Andrei) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.379&r2=1.380&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.379 ZendEngine2/zend_API.c:1.380 --- ZendEngine2/zend_API.c:1.379Mon Jul 17 20:52:12 2006 +++ ZendEngine2/zend_API.c Tue Jul 18 17:52:44 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.c,v 1.379 2006/07/17 20:52:12 andrei Exp $ */ +/* $Id: zend_API.c,v 1.380 2006/07/18 17:52:44 andrei Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2578,10 +2578,9 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC) { int retval; - zstr lcname, lmname, mname, colon; + zstr lmname, mname, colon; unsigned int clen, mlen; zend_function *fptr; - zend_class_entry **pce; HashTable *ftable; *ce_ptr = NULL; @@ -2601,18 +2600,7 @@ } } if (colon.v != NULL) { - lcname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, 0, &clen); - /* caution: lcname is not '\0' terminated */ - if (clen == sizeof("self") - 1 && - ZEND_U_EQUAL(Z_TYPE_P(callable), lcname, clen, "self", sizeof("self")-1)) { - *ce_ptr = EG(scope); - } else if (clen == sizeof("parent") - 1 && - ZEND_U_EQUAL(Z_TYPE_P(callable), lcname, clen, "parent", sizeof("parent")-1)) { - *ce_ptr = EG(scope) ? EG(scope)->parent : NULL; - } else if (zend_u_lookup_class(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { - *ce_ptr = *pce; - } - efree(lcname.v); + *ce_ptr = zend_u_fetch_class(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); if (!*ce_ptr) { return 0; } @@ -2620,9 +2608,9 @@ if (ce_org && !instanceof_function(ce_org, *ce_ptr TSRMLS_CC)) { return 0; } - lmname = zend_u_str_case_fold(Z_TYPE_P(callable), mname, mlen, 0, &mlen); + lmname = zend_u_str_case_fold(Z_TYPE_P(callable), mname, mlen, 1, &mlen); } else { - lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), Z_UNILEN_P(callable), 0, &mlen); + lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), Z_UNILEN_P(callable), 1, &mlen); if (ce_org) { ftable = &ce_org->function_table; *ce_ptr = ce_org; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.318&r2=1.319&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.318 ZendEngine2/zend_builtin_functions.c:1.319 --- ZendEngine2/zend_builtin_functions.c:1.318 Sat Jul 15 19:16:19 2006 +++ ZendEngine2/zend_builtin_functions.cTue Jul 18 17:52:44 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_builtin_functions.c,v 1.318 2006/07/15 19:16:19 helly Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.319 2006/07/18 17:52:44 andrei Exp $ */ #include "zend.h" #include "zend_API.h" @@ -702,7 +702,7 @@ convert_to_text_ex(class_name); - if (zend_u_lookup_class_ex(Z_TYPE_PP(class_name), Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name), (instance_ce != NULL) ? 1 : 0, &ce TSRMLS_CC) == FAILURE) { + if (zend_u_lookup_class_ex(Z_TYPE_PP(class_name), Z_UNIVAL_PP(class_name), Z_UNILEN_PP(class_name), (instance_ce != NULL) ? 1 : 0, 1, &ce TSRMLS_CC) == FAILURE) { retval = 0; } else { if (only_subclass) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.343&r2=1.344&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.343 ZendEngine2/zend_compile.h:1.344 --- ZendEngine2/zend_compile.h:1.343Tue Jun 13 12:56:20 2006 +++ ZendEngine2/zend_compile.h Tue Jul 18 17:52:44 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_compile.h,v 1.343
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
tony2001Thu Jul 13 12:34:30 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Unicode support in ReflectionParameter::__construct() http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.242&r2=1.243&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.242 php-src/ext/reflection/php_reflection.c:1.243 --- php-src/ext/reflection/php_reflection.c:1.242 Mon Jul 10 00:13:50 2006 +++ php-src/ext/reflection/php_reflection.c Thu Jul 13 12:34:30 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.242 2006/07/10 00:13:50 helly Exp $ */ +/* $Id: php_reflection.c,v 1.243 2006/07/13 12:34:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1866,10 +1866,12 @@ zend_uint i; position= -1; - convert_to_string_ex(¶meter); + convert_to_text_ex(¶meter); for (i = 0; i < fptr->common.num_args; i++) { - /* FIXME: Unicode support??? */ - if (arg_info[i].name.s && strcmp(arg_info[i].name.s, Z_STRVAL_P(parameter)) == 0) { + if (Z_TYPE_P(parameter) == IS_STRING && arg_info[i].name.s && strcmp(arg_info[i].name.s, Z_STRVAL_P(parameter)) == 0) { + position= i; + break; + } else if (Z_TYPE_P(parameter) == IS_UNICODE && arg_info[i].name.u && u_strcmp(arg_info[i].name.u, Z_USTRVAL_P(parameter)) == 0) { position= i; break; } @@ -4836,7 +4838,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.242 2006/07/10 00:13:50 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.243 2006/07/13 12:34:30 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug37816.phpt
helly Mon Jul 10 00:13:50 2006 UTC Added files: /php-src/ext/reflection/tests bug37816.phpt Modified files: /php-src/ext/reflection php_reflection.c Log: - Fix bug #37816 ReflectionProperty does not throw exception when accessing protected attribute http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.241&r2=1.242&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.241 php-src/ext/reflection/php_reflection.c:1.242 --- php-src/ext/reflection/php_reflection.c:1.241 Sun Jul 9 23:28:59 2006 +++ php-src/ext/reflection/php_reflection.c Mon Jul 10 00:13:50 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.241 2006/07/09 23:28:59 helly Exp $ */ +/* $Id: php_reflection.c,v 1.242 2006/07/10 00:13:50 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3907,24 +3907,25 @@ { reflection_object *intern; property_reference *ref; - zval *object; + zval *object, name; zval **member= NULL; zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); -#if MBO_0 if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { - _DO_THROW("Cannot access non-public member"); - /* Returns from this function */ + _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + "Cannot access non-public member %v::%v", intern->ce->name, Z_UNIVAL(name)); + zval_dtor(&name); + return; } -#endif if ((ref->prop->flags & ZEND_ACC_STATIC)) { zend_update_class_constants(intern->ce TSRMLS_CC); if (zend_u_hash_quick_find(CE_STATIC_MEMBERS(intern->ce), utype, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v", ref->prop->name); + zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop->name); /* Bails out */ } } else { @@ -3932,7 +3933,7 @@ return; } if (zend_u_hash_quick_find(Z_OBJPROP_P(object), utype, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v", ref->prop->name); + zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop->name); /* Bails out */ } } @@ -3950,7 +3951,7 @@ reflection_object *intern; property_reference *ref; zval **variable_ptr; - zval *object; + zval *object, name; zval *value; int setter_done = 0; zval *tmp; @@ -3961,8 +3962,11 @@ GET_REFLECTION_OBJECT_PTR(ref); if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { - _DO_THROW("Cannot access non-public member"); - /* Returns from this function */ + _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + "Cannot access non-public member %v::%v", intern->ce->name, Z_UNIVAL(name)); + zval_dtor(&name); + return; } if ((ref->prop->flags & ZEND_ACC_STATIC)) { @@ -3981,7 +3985,7 @@ } if (zend_u_hash_quick_find(prop_table, utype, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &variable_ptr) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %v", ref->prop->name); + zend_error(E_ERROR, "Internal error: Could not find the property %v::%v", intern->ce->name, ref->prop->name); /* Bails out */ } if (*variable_ptr == value) { @@ -4832,7 +4836,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.241 2006/07/09 23:28:59 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.242 2006/07/10 00:13:50 helly Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug37816.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug37816.phpt +++ php-src/ext/reflection/tests/bug37816.phpt --TEST
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sun Jul 9 23:28:59 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fix logic http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.240&r2=1.241&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.240 php-src/ext/reflection/php_reflection.c:1.241 --- php-src/ext/reflection/php_reflection.c:1.240 Fri Jul 7 11:53:54 2006 +++ php-src/ext/reflection/php_reflection.c Sun Jul 9 23:28:59 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.240 2006/07/07 11:53:54 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.241 2006/07/09 23:28:59 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3960,7 +3960,7 @@ METHOD_NOTSTATIC(reflection_property_ptr); GET_REFLECTION_OBJECT_PTR(ref); - if (ref->prop->flags & ~(ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)) { + if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { _DO_THROW("Cannot access non-public member"); /* Returns from this function */ } @@ -4832,7 +4832,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.240 2006/07/07 11:53:54 bjori Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.241 2006/07/09 23:28:59 helly Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Fri Jul 7 11:53:54 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Added new method to see if function is disabled or not http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.239&r2=1.240&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.239 php-src/ext/reflection/php_reflection.c:1.240 --- php-src/ext/reflection/php_reflection.c:1.239 Tue Jul 4 15:37:13 2006 +++ php-src/ext/reflection/php_reflection.c Fri Jul 7 11:53:54 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.239 2006/07/04 15:37:13 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.240 2006/07/07 11:53:54 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1429,6 +1429,19 @@ } /* }}} */ +/* {{{ proto public bool ReflectionFunction::isDisabled() + Returns whether this function has been disabled or not */ +ZEND_METHOD(reflection_function, isDisabled) +{ + reflection_object *intern; + zend_function *fptr; + + METHOD_NOTSTATIC(reflection_function_ptr); + GET_REFLECTION_OBJECT_PTR(fptr); + RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION && fptr->internal_function.handler == zif_display_disabled_function); +} +/* }}} */ + /* {{{ proto public string ReflectionFunction::getFileName() Returns the filename of the file this function was declared in */ ZEND_METHOD(reflection_function, getFileName) @@ -4399,6 +4412,7 @@ static zend_function_entry reflection_function_functions[] = { ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + ZEND_ME(reflection_function, isDisabled, NULL, 0) ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0) ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0) {NULL, NULL, NULL} @@ -4818,7 +4832,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.239 2006/07/04 15:37:13 bjori Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.240 2006/07/07 11:53:54 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Tue Jul 4 15:33:32 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Fix protos&arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.237&r2=1.238&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.237 php-src/ext/reflection/php_reflection.c:1.238 --- php-src/ext/reflection/php_reflection.c:1.237 Sat Jun 24 18:53:51 2006 +++ php-src/ext/reflection/php_reflection.c Tue Jul 4 15:33:32 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.237 2006/06/24 18:53:51 helly Exp $ */ +/* $Id: php_reflection.c,v 1.238 2006/07/04 15:33:32 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2969,7 +2969,7 @@ } /* }}} */ -/* {{{ proto public ReflectionMethod[] ReflectionClass::getMethods() +/* {{{ proto public ReflectionMethod[] ReflectionClass::getMethods([long $filter]) Returns an array of this class' methods */ ZEND_METHOD(reflection_class, getMethods) { @@ -3134,7 +3134,7 @@ } /* }}} */ -/* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties() +/* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties([long $filter]) Returns an array of this class' properties */ ZEND_METHOD(reflection_class, getProperties) { @@ -3383,7 +3383,7 @@ } /* }}} */ -/* {{{ proto public stdclass ReflectionClass::newInstanceArgs(array args) +/* {{{ proto public stdclass ReflectionClass::newInstanceArgs([array args]) Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstanceArgs) { @@ -4484,6 +4484,11 @@ ZEND_END_ARG_INFO() static +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0) + ZEND_ARG_INFO(0, $filter) +ZEND_END_ARG_INFO() + +static ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasProperty, 0) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() @@ -4494,6 +4499,11 @@ ZEND_END_ARG_INFO() static +ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getProperties, 0, 0, 0) + ZEND_ARG_INFO(0, filter) +ZEND_END_ARG_INFO() + +static ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasConstant, 0) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() @@ -4514,7 +4524,7 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceArgs, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstanceArgs, 0, 0, 0) ZEND_ARG_ARRAY_INFO(0, args, 0) ZEND_END_ARG_INFO() @@ -4544,10 +4554,10 @@ ZEND_ME(reflection_class, getConstructor, NULL, 0) ZEND_ME(reflection_class, hasMethod, arginfo_reflection_class_hasMethod, 0) ZEND_ME(reflection_class, getMethod, arginfo_reflection_class_getMethod, 0) - ZEND_ME(reflection_class, getMethods, NULL, 0) + ZEND_ME(reflection_class, getMethods, arginfo_reflection_class_getMethods, 0) ZEND_ME(reflection_class, hasProperty, arginfo_reflection_class_hasProperty, 0) ZEND_ME(reflection_class, getProperty, arginfo_reflection_class_getProperty, 0) - ZEND_ME(reflection_class, getProperties, NULL, 0) + ZEND_ME(reflection_class, getProperties, arginfo_reflection_class_getProperties, 0) ZEND_ME(reflection_class, hasConstant, arginfo_reflection_class_hasConstant, 0) ZEND_ME(reflection_class, getConstants, NULL, 0) ZEND_ME(reflection_class, getConstant, arginfo_reflection_class_getConstant, 0) @@ -4808,7 +4818,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.237 2006/06/24 18:53:51 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.238 2006/07/04 15:33:32 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
bjori Tue Jul 4 15:37:13 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: Obs. ZEND_BEGIN_ARG_INFO => ZEND_BEGIN_ARG_INFO_EX http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.238&r2=1.239&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.238 php-src/ext/reflection/php_reflection.c:1.239 --- php-src/ext/reflection/php_reflection.c:1.238 Tue Jul 4 15:33:32 2006 +++ php-src/ext/reflection/php_reflection.c Tue Jul 4 15:37:13 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.238 2006/07/04 15:33:32 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.239 2006/07/04 15:37:13 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -4499,7 +4499,7 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getProperties, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getProperties, 0, 0, 0) ZEND_ARG_INFO(0, filter) ZEND_END_ARG_INFO() @@ -4818,7 +4818,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.238 2006/07/04 15:33:32 bjori Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.239 2006/07/04 15:37:13 bjori Exp $"); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php