php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62303 ReflectionClass, getMethods(), getName() empty
Submitted: 2012-06-12 21:01 UTC Modified: 2013-02-18 00:35 UTC
From: v at roxori dot com Assigned:
Status: No Feedback Package: Reflection related
PHP Version: 5.4.3 OS: FreeBSD9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: v at roxori dot com
New email:
PHP Version: OS:

 

 [2012-06-12 21:01 UTC] v at roxori dot com
Description:
------------
After upgrading PHP to 5.4.3 no longer return the name of the method. 
Correspondingly, the library stopped working, namely Zend. Now the issue Fatal 
error: Uncaught exception 'Zend_Amf_Server_Exception' with message 'Duplicate 
method registered: Having sorted out, I realized that the code does not return the 
name of the method. In PHP 5.3 all was ok.

---
From manual page: http://www.php.net/reflectionclass.getname#refsect1-
reflectionclass.getname-description
---

Test script:
---------------
class Foo {

	function first(){

	}

	function second(){

	}
}

$foo = new Foo();

$reflect = new ReflectionClass($foo);

$props   = $reflect->getMethods();

foreach ($props as $prop) {
	print $prop->getName() . "\n";
}


Expected result:
----------------
first
second

Actual result:
--------------
(empty)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 22:51 UTC] nikic@php.net
I can't reproduce this: http://3v4l.org/6cvK8#v500

Seems to behave the same on all versions, with no change in between.

Maybe this is OS specific (or specific to something else in your env).
 [2012-06-12 23:56 UTC] sixd@php.net
-Status: Open +Status: Feedback
 [2012-06-13 08:06 UTC] v at roxori dot com
-Status: Feedback +Status: Open
 [2012-06-13 08:06 UTC] v at roxori dot com
Another found that the index broken array, so that probably does not display a 
value.

PHP5.4.3  FreeBSD9
ReflectionMethod Object
(
    [namei˜Ґ] => first
    [class] => Foo
)
ReflectionMethod Object
(
    [namei˜Ґ] => second
    [class] => Foo
)

PHP5.4.3 Linux

ReflectionMethod Object
(
    [name] => first
    [class] => Foo
)
ReflectionMethod Object
(
    [name] => second
    [class] => Foo
)
 [2012-07-25 12:29 UTC] fa@php.net
Cannot reproduce.

$ php -v
PHP 5.4.4 (cli) (built: Jun 28 2012 15:38:36)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

php testp.php
first
second


FreeBSD host.example.org 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 
UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
 [2012-07-26 01:38 UTC] aharvey@php.net
I also can't reproduce this. What extensions do you have loaded into PHP?
 [2012-07-26 01:38 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2012-07-26 06:33 UTC] v at roxori dot com
Another remarked that in cgi mode, it happens.

#php info.php
ReflectionMethod Object
(
[name] => first
[class] => Foo
)
ReflectionMethod Object
(
[name] => second
[class] => Foo
)


#php-cgi info.php
X-Powered-By: PHP/5.4.3
Content-type: text / html

ReflectionMethod Object
(
[namei ≤ ╔
] => First
[class] => Foo
)
ReflectionMethod Object
(
[namei ≤ ╔
] => Second
[class] => Foo
)

---------------------
apc.so
bz2.so
core.so
ctype.so
curl.so
date.so
dom.so
ereg.so
filter.so
gd.so
hash.so
iconv.so
json.so
libxml.so
mbstring.so
mcrypt.so
mhash.so
mysql.so
mysqli.so
mysqlnd.so
openssl.so
pcre.so
pdo.so
pdo_mysql.so
pdo_sqlite.so
phar.so
posix.so
reflection.so
session.so
simplexml.so
soap.so
sockets.so
spl.so
sqlite.so
sqlite3.so
standard.so
tokenizer.so
xml.so
xmlreader.so
xmlrpc.so
xmlwriter.so
zip.so
zlib.so
 [2012-07-26 06:33 UTC] v at roxori dot com
-Status: Feedback +Status: Open
 [2012-07-26 06:44 UTC] aharvey@php.net
Does it still happen if you remove APC?
 [2012-07-26 06:44 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 00:03:13 2021 UTC