Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12943 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88073 invoked by uid 1010); 23 Sep 2004 05:52:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87991 invoked from network); 23 Sep 2004 05:52:48 -0000 Received: from unknown (HELO main.gmane.org) (80.91.229.2) by pb1.pair.com with SMTP; 23 Sep 2004 05:52:48 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CAMXA-0002LU-00 for ; Thu, 23 Sep 2004 07:52:48 +0200 Received: from pd95fbf8e.dip.t-dialin.net ([217.95.191.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2004 07:52:48 +0200 Received: from sb by pd95fbf8e.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2004 07:52:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Thu, 23 Sep 2004 07:52:41 +0200 Lines: 90 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pd95fbf8e.dip.t-dialin.net User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Sender: news Subject: Re: [PHP-DEV] Weird engine problem From: sb@sebastian-bergmann.de (Sebastian Bergmann) 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