note 104549 added to reflectionclass.getmethods
| From: | deminy at deminy dot net | Date: | Wed, 22 Jun 2011 16:24:04 +0000 |
| Subject: | note 104549 added to reflectionclass.getmethods | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180847@lists.php.net to get a copy of this message | ||
Method ReflectionClass::getMethods doesn't work constantly across different versions of PHP.
For following code piece
<?php
class Dummy implements Iterator
{
public function current () {}
public function next () {}
public function key () {}
public function valid () {}
public function rewind () {}
}
$reflection = new ReflectionClass('Dummy');
$aMethods = $reflection->getMethods();
echo '# of methods: ', count($aMethods), "\n";
?>
, it outputs "# of methods: 10" on PHP 5.2.14 and PHP 5.2.17, including all methods
defined in the class itself and in the interface no matter if a method has been implemented or
overridden; however, it returns "# of methods: 5" on PHP 5.3.5. Based on some other tests
did by my colleagues, I assume it also returns "# of methods: 5" on PHP 5.2.10 and PHP
5.3.6.
----
Server IP: 192.41.42.26
Probable Submitter: 208.67.191.196
----
Manual Page -- http://www.php.net/manual/en/reflectionclass.getmethods.php
Edit -- https://master.php.net/note/edit/104549
Del: integrated -- https://master.php.net/note/delete/104549/integrated
Del: useless -- https://master.php.net/note/delete/104549/useless
Del: bad code -- https://master.php.net/note/delete/104549/bad+code
Del: spam -- https://master.php.net/note/delete/104549/spam
Del: non-english -- https://master.php.net/note/delete/104549/non-english
Del: in docs -- https://master.php.net/note/delete/104549/in+docs
Del: other reasons-- https://master.php.net/note/delete/104549
Reject -- https://master.php.net/note/reject/104549
Search -- https://master.php.net/manage/user-notes.php