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
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: dany at timoshka-lab dot co dot jp
New email:
PHP Version: OS:

 

 [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: Wed Jul 08 01:01:25 2020 UTC