cvs: ZendEngine2(PHP_5_2) / zend_constants.c zend_constants.h zend_execute.h zend_execute_API.c php-src NEWS php-src/ext/reflection php_reflection.c
php-src/ext/reflection/tests bug38465.phpt
| From: | Johannes Schl�ter | Date: | Wed, 18 Oct 2006 16:35:15 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_2) / zend_constants.c zend_constants.h zend_execute.h zend_execute_API.c php-src NEWS php-src/ext/reflection php_reflection.c php-src/ext/reflection/tests bug38465.phpt |
||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5334@lists.php.net to get a copy of this message | ||
johannes Wed Oct 18 16:35:15 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/reflection/tests bug38465.phpt
Modified files:
/php-src NEWS
/php-src/ext/reflection php_reflection.c
/ZendEngine2 zend_constants.c zend_constants.h zend_execute.h
zend_execute_API.c
Log:
- MFH: Fix #38465 (ReflectionParameter fails if default value is an access to self::
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.308&r2=1.2027.2.547.2.309&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.308 php-src/NEWS:1.2027.2.547.2.309 --- php-src/NEWS:1.2027.2.547.2.308 Wed Oct 18 14:23:23 2006 +++ php-src/NEWS Wed Oct 18 16:35:15 2006 @@ -19,6 +19,8 @@ - Fixed bug #38934 (move_uploaded_file() cannot read uploaded file outside of open_basedir). (Ilia) - Fixed bug #38649 (uninit'd optional arg in stream_socket_sendto()). (Sara) +- Fixed bug #38465 (ReflectionParameter fails if default value is an access to + self::). (Johannes) - Fixed bug #38198 (possible crash when COM reports an exception). (Ilia) - Fixed bug #37262 (var_export() does not escape \0 character). (Ilia) - Fixed bug #36515 (Unlinking buckets from non-existant brigades). (Sara) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.30&r2=1.164.2.33.2.31&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.30 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.31 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.30 Wed Oct 11 15:52:56 2006 +++ php-src/ext/reflection/php_reflection.c Wed Oct 18 16:35:15 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.164.2.33.2.30 2006/10/11 15:52:56 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.164.2.33.2.31 2006/10/18 16:35:15 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2132,7 +2132,7 @@ zv_copy = precv->op2.u.constant; zv = &zv_copy; - zval_update_constant(&zv, (void*)0 TSRMLS_CC); + zval_update_constant_ex(&zv, (void*)0, param->fptr->common.scope TSRMLS_CC); RETURN_ZVAL(zv, 1, 1); } /* }}} */ @@ -4851,7 +4851,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.164.2.33.2.30 2006/10/11 15:52:56 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.31 2006/10/18 16:35:15 johannes Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.71.2.5.2.1&r2=1.71.2.5.2.2&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.71.2.5.2.1 ZendEngine2/zend_constants.c:1.71.2.5.2.2 --- ZendEngine2/zend_constants.c:1.71.2.5.2.1 Wed May 10 14:04:18 2006 +++ ZendEngine2/zend_constants.c Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.71.2.5.2.1 2006/05/10 14:04:18 tony2001 Exp $ */ +/* $Id: zend_constants.c,v 1.71.2.5.2.2 2006/10/18 16:35:15 johannes Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -213,7 +213,7 @@ } -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -222,17 +222,19 @@ if ((colon = memchr(name, ':', name_len)) && colon[1] == ':') { /* class constant */ - zend_class_entry **ce = NULL, *scope; + zend_class_entry **ce = NULL; int class_name_len = colon-name; int const_name_len = name_len - class_name_len - 2; char *constant_name = colon+2; zval **ret_constant; char *class_name; - if (EG(in_execution)) { - scope = EG(scope); - } else { - scope = CG(active_class_entry); + if (!scope) { + if (EG(in_execution)) { + scope = EG(scope); + } else { + scope = CG(active_class_entry); + } } class_name = estrndup(name, class_name_len); @@ -300,6 +302,10 @@ return retval; } +ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) +{ + zend_get_constant_ex(name, name_len, result, NULL TSRMLS_CC); +} ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.h?r1=1.31.2.2&r2=1.31.2.2.2.1&diff_format=u Index: ZendEngine2/zend_constants.h diff -u ZendEngine2/zend_constants.h:1.31.2.2 ZendEngine2/zend_constants.h:1.31.2.2.2.1 --- ZendEngine2/zend_constants.h:1.31.2.2 Wed Mar 15 09:04:36 2006 +++ ZendEngine2/zend_constants.h Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.h,v 1.31.2.2 2006/03/15 09:04:36 dmitry Exp $ */ +/* $Id: zend_constants.h,v 1.31.2.2.2.1 2006/10/18 16:35:15 johannes Exp $ */ #ifndef ZEND_CONSTANTS_H #define ZEND_CONSTANTS_H @@ -56,6 +56,7 @@ void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC); ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.h?r1=1.84.2.4.2.3&r2=1.84.2.4.2.4&diff_format=u Index: ZendEngine2/zend_execute.h diff -u ZendEngine2/zend_execute.h:1.84.2.4.2.3 ZendEngine2/zend_execute.h:1.84.2.4.2.4 --- ZendEngine2/zend_execute.h:1.84.2.4.2.3 Mon Jun 5 13:58:51 2006 +++ ZendEngine2/zend_execute.h Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.84.2.4.2.3 2006/06/05 13:58:51 zeev Exp $ */ +/* $Id: zend_execute.h,v 1.84.2.4.2.4 2006/10/18 16:35:15 johannes Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H @@ -134,6 +134,7 @@ } ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC); +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC); /* dedicated Zend executor functions - do not use! */ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.8&r2=1.331.2.20.2.9&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.8 ZendEngine2/zend_execute_API.c:1.331.2.20.2.9 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.8 Wed Oct 11 16:11:56 2006 +++ ZendEngine2/zend_execute_API.c Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.8 2006/10/11 16:11:56 tony2001 Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.9 2006/10/18 16:35:15 johannes Exp $ */ #include <stdio.h> #include <signal.h> @@ -448,7 +448,7 @@ #include "../TSRM/tsrm_strtok_r.h" -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) { zval *p = *pp; zend_bool inline_change = (zend_bool) (unsigned long) arg; @@ -464,7 +464,7 @@ refcount = p->refcount; is_ref = p->is_ref; - if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) { + if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", p->value.str.val, p->value.str.val); @@ -503,7 +503,7 @@ zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) { + if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); zend_hash_move_forward(Z_ARRVAL_P(p)); continue; @@ -552,6 +552,10 @@ return 0; } +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +{ + zval_update_constant_ex(pp, arg, NULL TSRMLS_CC); +} int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38465.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug38465.phpt +++ php-src/ext/reflection/tests/bug38465.phpt --TEST-- Reflection Bug #38465 (ReflectionParameter fails on access to self::) --SKIPIF-- <?php extension_loaded('reflection') or die('skip'); ?> --FILE-- <?php class Baz { const B = 3; } class Foo { const X = 1; private $propA = self::X; private $propB = Baz::B; private $propC = 99; public function x($a = self::X, $b = Baz::B, $c = 99) {} } class Bar extends Foo { const Y = 2; private $propA = self::X; private $propB = Baz::B; private $propC = 99; public function y($a = self::Y, $b = Baz::B, $c = 99) {} } echo "From global scope:\n"; $clazz = new ReflectionClass('Bar'); foreach ($clazz->getProperties() as $property) { echo $property->getDeclaringClass()->getName(), '::$', $property->getName(), ' = ', $property->getDefaultValue(), "\n"; } foreach ($clazz->getMethods() as $method) { foreach ($method->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { echo $method->getDeclaringClass()->getName(), '::', $method->getName(), '($', $param->getName(), ' = ', $param->getDefaultValue(), ")\n"; } } } echo "\nFrom class context:\n"; class Test { function __construct() { $clazz = new ReflectionClass('Bar'); foreach ($clazz->getProperties() as $property) { echo $property->getDeclaringClass()->getName(), '::$', $property->getName(), ' = ', $property->getDefaultValue(), "\n"; } foreach ($clazz->getMethods() as $method) { foreach ($method->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { echo $method->getDeclaringClass()->getName(), '::', $method->getName(), '($', $param->getName(), ' = ', $param->getDefaultValue(), ")\n"; } } } } } new Test(); ?> --EXPECT-- From global scope: Bar::$propA = 1 Bar::$propB = 3 Bar::$propC = 99 Bar::y($a = 2) Bar::y($b = 3) Bar::y($c = 99) Foo::x($a = 1) Foo::x($b = 3) Foo::x($c = 99) From class context: Bar::$propA = 1 Bar::$propB = 3 Bar::$propC = 99 Bar::y($a = 2) Bar::y($b = 3) Bar::y($c = 99) Foo::x($a = 1) Foo::x($b = 3) Foo::x($c = 99)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.308&r2=1.2027.2.547.2.309&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.308 php-src/NEWS:1.2027.2.547.2.309 --- php-src/NEWS:1.2027.2.547.2.308 Wed Oct 18 14:23:23 2006 +++ php-src/NEWS Wed Oct 18 16:35:15 2006 @@ -19,6 +19,8 @@ - Fixed bug #38934 (move_uploaded_file() cannot read uploaded file outside of open_basedir). (Ilia) - Fixed bug #38649 (uninit'd optional arg in stream_socket_sendto()). (Sara) +- Fixed bug #38465 (ReflectionParameter fails if default value is an access to + self::). (Johannes) - Fixed bug #38198 (possible crash when COM reports an exception). (Ilia) - Fixed bug #37262 (var_export() does not escape \0 character). (Ilia) - Fixed bug #36515 (Unlinking buckets from non-existant brigades). (Sara) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.30&r2=1.164.2.33.2.31&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.30 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.31 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.30 Wed Oct 11 15:52:56 2006 +++ php-src/ext/reflection/php_reflection.c Wed Oct 18 16:35:15 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.164.2.33.2.30 2006/10/11 15:52:56 tony2001 Exp $ */ +/* $Id: php_reflection.c,v 1.164.2.33.2.31 2006/10/18 16:35:15 johannes Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2132,7 +2132,7 @@ zv_copy = precv->op2.u.constant; zv = &zv_copy; - zval_update_constant(&zv, (void*)0 TSRMLS_CC); + zval_update_constant_ex(&zv, (void*)0, param->fptr->common.scope TSRMLS_CC); RETURN_ZVAL(zv, 1, 1); } /* }}} */ @@ -4851,7 +4851,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.164.2.33.2.30 2006/10/11 15:52:56 tony2001 Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.31 2006/10/18 16:35:15 johannes Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.71.2.5.2.1&r2=1.71.2.5.2.2&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.71.2.5.2.1 ZendEngine2/zend_constants.c:1.71.2.5.2.2 --- ZendEngine2/zend_constants.c:1.71.2.5.2.1 Wed May 10 14:04:18 2006 +++ ZendEngine2/zend_constants.c Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.71.2.5.2.1 2006/05/10 14:04:18 tony2001 Exp $ */ +/* $Id: zend_constants.c,v 1.71.2.5.2.2 2006/10/18 16:35:15 johannes Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -213,7 +213,7 @@ } -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -222,17 +222,19 @@ if ((colon = memchr(name, ':', name_len)) && colon[1] == ':') { /* class constant */ - zend_class_entry **ce = NULL, *scope; + zend_class_entry **ce = NULL; int class_name_len = colon-name; int const_name_len = name_len - class_name_len - 2; char *constant_name = colon+2; zval **ret_constant; char *class_name; - if (EG(in_execution)) { - scope = EG(scope); - } else { - scope = CG(active_class_entry); + if (!scope) { + if (EG(in_execution)) { + scope = EG(scope); + } else { + scope = CG(active_class_entry); + } } class_name = estrndup(name, class_name_len); @@ -300,6 +302,10 @@ return retval; } +ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) +{ + zend_get_constant_ex(name, name_len, result, NULL TSRMLS_CC); +} ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.h?r1=1.31.2.2&r2=1.31.2.2.2.1&diff_format=u Index: ZendEngine2/zend_constants.h diff -u ZendEngine2/zend_constants.h:1.31.2.2 ZendEngine2/zend_constants.h:1.31.2.2.2.1 --- ZendEngine2/zend_constants.h:1.31.2.2 Wed Mar 15 09:04:36 2006 +++ ZendEngine2/zend_constants.h Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.h,v 1.31.2.2 2006/03/15 09:04:36 dmitry Exp $ */ +/* $Id: zend_constants.h,v 1.31.2.2.2.1 2006/10/18 16:35:15 johannes Exp $ */ #ifndef ZEND_CONSTANTS_H #define ZEND_CONSTANTS_H @@ -56,6 +56,7 @@ void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_get_constant_ex(char *name, uint name_len, zval *result, zend_class_entry *scope TSRMLS_DC); ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.h?r1=1.84.2.4.2.3&r2=1.84.2.4.2.4&diff_format=u Index: ZendEngine2/zend_execute.h diff -u ZendEngine2/zend_execute.h:1.84.2.4.2.3 ZendEngine2/zend_execute.h:1.84.2.4.2.4 --- ZendEngine2/zend_execute.h:1.84.2.4.2.3 Mon Jun 5 13:58:51 2006 +++ ZendEngine2/zend_execute.h Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.84.2.4.2.3 2006/06/05 13:58:51 zeev Exp $ */ +/* $Id: zend_execute.h,v 1.84.2.4.2.4 2006/10/18 16:35:15 johannes Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H @@ -134,6 +134,7 @@ } ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC); +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC); /* dedicated Zend executor functions - do not use! */ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.8&r2=1.331.2.20.2.9&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.8 ZendEngine2/zend_execute_API.c:1.331.2.20.2.9 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.8 Wed Oct 11 16:11:56 2006 +++ ZendEngine2/zend_execute_API.c Wed Oct 18 16:35:15 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.8 2006/10/11 16:11:56 tony2001 Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.9 2006/10/18 16:35:15 johannes Exp $ */ #include <stdio.h> #include <signal.h> @@ -448,7 +448,7 @@ #include "../TSRM/tsrm_strtok_r.h" -ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) { zval *p = *pp; zend_bool inline_change = (zend_bool) (unsigned long) arg; @@ -464,7 +464,7 @@ refcount = p->refcount; is_ref = p->is_ref; - if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) { + if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", p->value.str.val, p->value.str.val); @@ -503,7 +503,7 @@ zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) { + if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); zend_hash_move_forward(Z_ARRVAL_P(p)); continue; @@ -552,6 +552,10 @@ return 0; } +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) +{ + zval_update_constant_ex(pp, arg, NULL TSRMLS_CC); +} int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38465.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug38465.phpt +++ php-src/ext/reflection/tests/bug38465.phpt --TEST-- Reflection Bug #38465 (ReflectionParameter fails on access to self::) --SKIPIF-- <?php extension_loaded('reflection') or die('skip'); ?> --FILE-- <?php class Baz { const B = 3; } class Foo { const X = 1; private $propA = self::X; private $propB = Baz::B; private $propC = 99; public function x($a = self::X, $b = Baz::B, $c = 99) {} } class Bar extends Foo { const Y = 2; private $propA = self::X; private $propB = Baz::B; private $propC = 99; public function y($a = self::Y, $b = Baz::B, $c = 99) {} } echo "From global scope:\n"; $clazz = new ReflectionClass('Bar'); foreach ($clazz->getProperties() as $property) { echo $property->getDeclaringClass()->getName(), '::$', $property->getName(), ' = ', $property->getDefaultValue(), "\n"; } foreach ($clazz->getMethods() as $method) { foreach ($method->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { echo $method->getDeclaringClass()->getName(), '::', $method->getName(), '($', $param->getName(), ' = ', $param->getDefaultValue(), ")\n"; } } } echo "\nFrom class context:\n"; class Test { function __construct() { $clazz = new ReflectionClass('Bar'); foreach ($clazz->getProperties() as $property) { echo $property->getDeclaringClass()->getName(), '::$', $property->getName(), ' = ', $property->getDefaultValue(), "\n"; } foreach ($clazz->getMethods() as $method) { foreach ($method->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { echo $method->getDeclaringClass()->getName(), '::', $method->getName(), '($', $param->getName(), ' = ', $param->getDefaultValue(), ")\n"; } } } } } new Test(); ?> --EXPECT-- From global scope: Bar::$propA = 1 Bar::$propB = 3 Bar::$propC = 99 Bar::y($a = 2) Bar::y($b = 3) Bar::y($c = 99) Foo::x($a = 1) Foo::x($b = 3) Foo::x($c = 99) From class context: Bar::$propA = 1 Bar::$propB = 3 Bar::$propC = 99 Bar::y($a = 2) Bar::y($b = 3) Bar::y($c = 99) Foo::x($a = 1) Foo::x($b = 3) Foo::x($c = 99)