cvs: php-src(PHP_5_2) / NEWS /ext/reflection php_reflection.c /ext/reflection/tests bug39001.phpt
| From: | Antony Dovgal | Date: | Mon, 02 Oct 2006 12:16:35 +0000 |
| Subject: | cvs: php-src(PHP_5_2) / NEWS /ext/reflection php_reflection.c /ext/reflection/tests bug39001.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-40819@lists.php.net to get a copy of this message | ||
tony2001 Mon Oct 2 12:16:35 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/reflection/tests bug39001.phpt
Modified files:
/php-src NEWS
/php-src/ext/reflection php_reflection.c
Log:
MFH: #39001 (ReflectionProperty returns incorrect declaring class for protected properties)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.275&r2=1.2027.2.547.2.276&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.275 php-src/NEWS:1.2027.2.547.2.276
--- php-src/NEWS:1.2027.2.547.2.275 Mon Oct 2 11:09:52 2006
+++ php-src/NEWS Mon Oct 2 12:16:35 2006
@@ -7,6 +7,8 @@
working exactly like in php.ini; with FastCGI -d affects all requests).
(Dmitry)
- Fixed bug #39003 (__autoload() is called for type hinting). (Dmitry, Tony)
+- Fixed bug #39001 (ReflectionProperty returns incorrect declaring class for
+ protected properties). (Tony)
- Fixed bug #38993 (Fixed safe_mode/open_basedir checks for
session.save_path, allowing them to account for extra parameters). (Ilia)
- Fixed bug #38981 (using FTP URLs in get_headers() causes crash). (Tony)
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.25&r2=1.164.2.33.2.26&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.25
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.26
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.25 Tue Sep 26 07:55:20 2006
+++ php-src/ext/reflection/php_reflection.c Mon Oct 2 12:16:35 2006
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.25 2006/09/26 07:55:20 dmitry Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.26 2006/10/02 12:16:35 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -4008,14 +4008,21 @@
property_reference *ref;
zend_class_entry *tmp_ce, *ce;
zend_property_info *tmp_info;
+ char *prop_name, *class_name;
+ int prop_name_len;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ref);
+ if (zend_unmangle_property_name(ref->prop->name, ref->prop->name_length,
&class_name, &prop_name) != SUCCESS) {
+ RETURN_FALSE;
+ }
+
+ prop_name_len = strlen(prop_name);
ce = tmp_ce = ref->ce;
- while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, ref->prop->name,
ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) {
+ while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, prop_name, prop_name_len
+ 1, (void **) &tmp_info) == SUCCESS) {
ce = tmp_ce;
- tmp_ce = tmp_ce->parent;
+ tmp_ce = tmp_ce->parent;
}
zend_reflection_class_factory(ce, return_value TSRMLS_CC);
@@ -4827,7 +4834,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.25
2006/09/26 07:55:20 dmitry Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.26
2006/10/02 12:16:35 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--
<?php
class Meta {
}
class CParent extends Meta {
public $publicVar;
protected $protectedVar;
}
class Child extends CParent {
}
$r = new ReflectionClass('Child');
var_dump($r->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