php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77086 method_exists doesn't support camel case ?
Submitted: 2018-10-31 03:49 UTC Modified: 2018-10-31 04:03 UTC
From: dany at timoshka-lab dot co dot jp Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 7.2.11 OS: CentOS 6.8
Private report: No CVE-ID: None
 [2018-10-31 03:49 UTC] dany at timoshka-lab dot co dot jp
Description:
------------
I think method_exists function should check method name with '===' operator.
Please take a look for sample code below.

Thanks,
Best Regards

Test script:
---------------
<?php

class A {
    public function testMethod()
    {
        
    }
}

$a = new A();

var_dump( method_exists($a, 'testmethod') );

Expected result:
----------------
false

Actual result:
--------------
true

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-31 03:55 UTC] spam2 at rhsoft dot net
besides the subject makes no sense function names in PHP are *NOT* case-sensitive - so why should method_exists?

<?php
class test_class
{
 public function test()
 {
  echo "test\n";
 }
}

$test = new test_class;
$test->TEST();
$test->test();
 [2018-10-31 04:03 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-10-31 04:03 UTC] requinix@php.net
Like he said.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jul 13 08:01:25 2020 UTC