|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56665 Can't add mixed-case method
Submitted: 2005-11-20 10:27 UTC Modified: 2013-02-23 19:13 UTC
From: jobapply at nextmail dot ru Assigned: pollita (profile)
Status: Closed Package: runkit (PECL)
PHP Version: 5_1 CVS-2005-11-20 OS: FreeBSD 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jobapply at nextmail dot ru
New email:
PHP Version: OS:


 [2005-11-20 10:27 UTC] jobapply at nextmail dot ru
Can't add a method with mixed-case naming.
Like 'Test', 'getA' ...

Reproduce code:

class Example  {


'return 5;',

$e = new Example();
echo $e->Test();

Expected result:

Actual result:
PHP Fatal error:  Call to undefined method Example::Test() in /var/site/setter/reproduce2.php on line 18

Fatal error: Call to undefined method Example::Test() in /var/site/setter/reproduce2.php on line 18


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-05 23:40 UTC] daniel dot oconnor at gmail dot com
Is this issue with PHP_RUNKIT_ADD_MAGIC_METHOD and the use of strcmp vs how class + method names are stored internally in PHP?

IE, using stricmp instead of strcmp would correct this issue?

Line #257
 [2009-07-21 20:42 UTC] pear dot neufeind at speedpartner dot de
@Daniel: strcmp is fine. Function table always has lower-case entries.

Entries into the function_table (zend_hash_add, ...) need to be performed with lowercase functionnames. Calls to get_class_methods will still show the mixed-case-variant since that's stored together with the function (separate of the function_table).

Testcase for direct as well as indirect calls to function with mixed-case as well as listing function names:
class Foo {
 function a() {

Tested fix for the problem:
--- runkit_methods.c.orig       2007-12-27 22:16:05.000000000 +0100
+++ runkit_methods.c    2009-07-22 02:32:02.000000000 +0200
@@ -344,6 +344,7 @@

        func.common.fn_flags |= ZEND_ACC_ALLOW_STATIC;
+       php_strtolower(methodname, methodname_len);

        zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t)php_runkit_update_children_methods, 5, ancestor_class, ce, &func, methodname,
 [2013-02-23 19:13 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: pollita
 [2013-02-23 19:13 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 21:01:33 2024 UTC