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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC