johannes Fri Feb 24 23:08:36 2006 UTC
Added files:
/php-src/ext/reflection/tests bug29986.phpt
Modified files:
/php-src/ext/reflection php_reflection.c
Log:
- Fix #29986 (Class constants won't work with predefined constants when
using ReflectionClass)
http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/php_reflection.c?r1=1.221&r2=1.222&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.221
php-src/ext/reflection/php_reflection.c:1.222
--- php-src/ext/reflection/php_reflection.c:1.221 Fri Feb 24 13:44:46 2006
+++ php-src/ext/reflection/php_reflection.c Fri Feb 24 23:08:36 2006
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.221 2006/02/24 13:44:46 johannes Exp $ */
+/* $Id: php_reflection.c,v 1.222 2006/02/24 23:08:36 johannes Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -347,6 +347,7 @@
/* Constants */
if (&ce->constants_table) {
+ zend_hash_apply_with_argument(&ce->constants_table,
(apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
string_printf(str, "\n");
count = zend_hash_num_elements(&ce->constants_table);
string_printf(str, "%s - Constants [%d] {\n", indent, count);
@@ -4499,7 +4500,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.221
2006/02/24 13:44:46 johannes Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.222
2006/02/24 23:08:36 johannes Exp $");
php_info_print_table_end();
} /* }}} */
http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/tests/bug29986.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug29986.phpt
+++ php-src/ext/reflection/tests/bug29986.phpt
--TEST--
Reflection::export
--SKIPIF--
<?php extension_loaded('reflection') or die('skip'); ?>
--FILE--
<?php
class just_constants
{
const BOOLEAN_CONSTANT = true;
const NULL_CONSTANT = null;
const STRING_CONSTANT = 'This is a string';
const INTEGER_CONSTANT = 1000;
const FLOAT_CONSTANT = 3.14159265;
}
Reflection::export(new ReflectionClass('just_constants'));
?>
--EXPECTF--
Class [ <user> class just_constants ] {
@@ %s
- Constants [5] {
Constant [ boolean BOOLEAN_CONSTANT ] { }
Constant [ null NULL_CONSTANT ] { }
Constant [ native string STRING_CONSTANT ] { }
Constant [ integer INTEGER_CONSTANT ] { }
Constant [ double FLOAT_CONSTANT ] { }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}
--UEXPECTF--
Class [ <user> class just_constants ] {
@@ %s
- Constants [5] {
Constant [ boolean BOOLEAN_CONSTANT ] { }
Constant [ null NULL_CONSTANT ] { }
Constant [ Unicode string STRING_CONSTANT ] { }
Constant [ integer INTEGER_CONSTANT ] { }
Constant [ double FLOAT_CONSTANT ] { }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php