|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-23 21:04 UTC] sebastian@php.net
[2004-10-07 05:25 UTC] sohu119 at sohu dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ Calling getMethod() on a ReflectionClass object for the current object lowercases the contents of the variable that is passed to it. Hardcoding the getMethod() parameter prevents the lowercasing while copying the value from $this->name to $name and passing that to getMethod() does not. Reproduce code: --------------- <?php class Foo { private $name = 'testBar'; public function testBar() { try { $class = new ReflectionClass($this); var_dump($this); $method = $class->getMethod($this->name); var_dump($this); } catch (Exception $e) {} } } $foo = new Foo; $foo->testBar(); ?> Expected result: ---------------- object(Foo)#1 (1) { ["name:private"]=> string(7) "testBar" } object(Foo)#1 (1) { ["name:private"]=> string(7) "testBar" } Actual result: -------------- object(Foo)#1 (1) { ["name:private"]=> string(7) "testBar" } object(Foo)#1 (1) { ["name:private"]=> string(7) "testbar" }