Re: Weird engine problem

From: Date: Thu, 23 Sep 2004 05:52:41 +0000
Subject: Re: Weird engine problem
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-12943@lists.php.net to get a copy of this message
Sebastian Bergmann wrote: > In PHPUnit2 I have the following code: It seems that I have been at slightly the wrong code try { $class = new ReflectionClass($this); var_dump($this); $method = $class->getMethod($this->name); var_dump($this); exit; } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testGetBalance" } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testgetbalance" } So it looks like 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 try { $class = new ReflectionClass($this); var_dump($this); $method = $class->getMethod('testGetBalance'); var_dump($this); exit; } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testGetBalance" } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testGetBalance" } while copying the value from $this->name to $name and passing that to getMethod() does not try { $class = new ReflectionClass($this); var_dump($this); $name = $this->name; $method = $class->getMethod($name); var_dump($this); exit; } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testGetBalance" } object(BankAccountTest)#38 (2) { ["codeCoverageInformation:private"]=> array(0) { } ["name:private"]=> string(14) "testgetbalance" } Sorry for these lengthy mails but this issue is important to me as it hinders the development of PHPUnit2. -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

« previous php.internals (#12943) next »