Bug #63256 [NEW]: ReflectionProperty::getName() returns false

From: Date: Wed, 10 Oct 2012 21:48:33 +0000
Subject: Bug #63256 [NEW]: ReflectionProperty::getName() returns false
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174001@lists.php.net to get a copy of this message
From:             asynchronio at gmail dot com
Operating system: Windows 7 (x64)
PHP version:      5.4.7
Package:          Reflection related
Bug Type:         Bug
Bug description:ReflectionProperty::getName() returns false

Description:
------------
ReflectionProperty name getter returns false, but getting name directly
works 
fine.

Test script:
---------------
<?php
class Test {
	public $foo = 1;
	public $bar = 2;
	
	public function test()
	{
		$class = new ReflectionClass(get_class($this));
		$names = array();
		foreach($class->getProperties() as $property)
		{
			$names[] = $property->getName();
                        // This code works:
                        // $names[] = $property->name;

		}
		return $names;
	}

}

$test = new Test();
var_dump($test->test());

Expected result:
----------------
array(2) { [0]=> 1 [1]=> 2 }

Actual result:
--------------
array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" }

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63256&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=63256&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=63256&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=63256&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63256&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63256&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63256&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63256&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63256&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63256&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63256&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=63256&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=63256&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63256&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63256&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63256&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63256&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63256&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63256&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63256&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63256&r=mysqlcfg



Thread (11 messages)

« previous php.bugs (#174001) next »