cvs: ZendEngine2(PHP_5_3) / zend_builtin_functions.c /tests get_class_vars_003.phpt get_class_vars_006.phpt
[email protected] ("Arnaud Le Blanc") Fri, 22 May 2009 11:19:30 -0000
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvslbarnaud1242991170@cvsserver> |
lbarnaud Fri May 22 11:19:30 2009 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_builtin_functions.c
/ZendEngine2/tests get_class_vars_003.phpt get_class_vars_006.phpt
Log:
MFH: Use zend_get_property_info() in get_class_vars() (fixes #46812)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.12.2.25.2.48&r2=1.277.2.12.2.25.2.49&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.25.2.48 ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.25.2.49
--- ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.25.2.48 Thu May 7 12:08:09 2009
+++ ZendEngine2/zend_builtin_functions.c Fri May 22 11:19:30 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.25.2.48 2009/05/07 12:08:09 felipe Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.25.2.49 2009/05/22 11:19:30 lbarnaud Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -890,27 +890,22 @@
while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
char *key, *class_name, *prop_name;
uint key_len;
- ulong num_index, h;
+ ulong num_index;
int prop_name_len = 0;
zval *prop_copy;
zend_property_info *property_info;
+ zval zprop_name;
zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(properties, &pos);
zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
prop_name_len = strlen(prop_name);
-
- h = zend_get_hash_value(prop_name, prop_name_len+1);
- if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_len+1, h, (void **) &property_info) == FAILURE) {
- continue;
- }
-
- if (property_info->flags & ZEND_ACC_SHADOW) {
- continue;
- } else if ((property_info->flags & ZEND_ACC_PRIVATE) && EG(scope) != ce) {
- continue;
- } else if ((property_info->flags & ZEND_ACC_PROTECTED) && zend_check_protected(ce, EG(scope)) == 0) {
+
+ ZVAL_STRINGL(&zprop_name, prop_name, prop_name_len, 0);
+ property_info = zend_get_property_info(ce, &zprop_name, 1 TSRMLS_CC);
+
+ if (!property_info || property_info == &EG(std_property_info)) {
continue;
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/get_class_vars_003.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: ZendEngine2/tests/get_class_vars_003.phpt
diff -u ZendEngine2/tests/get_class_vars_003.phpt:1.1.2.2 ZendEngine2/tests/get_class_vars_003.phpt:1.1.2.3
--- ZendEngine2/tests/get_class_vars_003.phpt:1.1.2.2 Fri Aug 22 00:59:39 2008
+++ ZendEngine2/tests/get_class_vars_003.phpt Fri May 22 11:19:30 2009
@@ -33,7 +33,7 @@
?>
--EXPECT--
-array(5) {
+array(6) {
["aaa"]=>
int(7)
["ccc"]=>
@@ -42,6 +42,8 @@
int(1)
["aa"]=>
int(4)
+ ["bb"]=>
+ int(5)
["cc"]=>
int(6)
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/get_class_vars_006.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: ZendEngine2/tests/get_class_vars_006.phpt
diff -u ZendEngine2/tests/get_class_vars_006.phpt:1.1.2.2 ZendEngine2/tests/get_class_vars_006.phpt:1.1.2.3
--- ZendEngine2/tests/get_class_vars_006.phpt:1.1.2.2 Fri Aug 22 00:59:39 2008
+++ ZendEngine2/tests/get_class_vars_006.phpt Fri May 22 11:19:30 2009
@@ -44,5 +44,7 @@
["a"]=>
int(1)
}
-array(0) {
+array(1) {
+ ["a"]=>
+ int(1)
}