php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17882 case sensitivity of functions in classes
Submitted: 2002-06-20 13:38 UTC Modified: 2002-11-10 16:03 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: erickoh at chopchopsolutions dot com Assigned: andi (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.0-dev OS: Linux
Private report: No CVE-ID: None
 [2002-06-20 13:38 UTC] erickoh at chopchopsolutions dot com
/*
Result of code below is 'AA' instead of 'aA'
If this is normal behavior, I think a note about
this should be made in the documentation.
*/
<?php
class X {
  function a() {
    echo 'a';
  }  
  function A() {
    echo 'A';
  } 
}
X::a();
X::A();
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-20 13:47 UTC] sander@php.net
Functions names are not case sensitive and I'm sure that's noted somewhere in the manual.
 [2002-06-20 14:02 UTC] erickoh at chopchopsolutions dot com
Hi,

I understand that PHP functions are not case sensitive.
Declaring such 2 functions outside a class gives:

Fatal error: Cannot redeclare a() in /var/www/html/a.php on line 6

However declaring the same 2 functions in a class produces no errors. This led me to believe that class methods are case-sensitive.

I think it will be nice if an error can be thrown during the interpretation phase, else a note about this should be put in under the section 'PHP Classes'
 [2002-06-20 14:06 UTC] sander@php.net
Hm, you're right. This is a bug. Confirmed with 4.3.0-dev.
 [2002-06-20 14:13 UTC] mfischer@php.net
It's actually a duplicate, I'm pretty sure, but can't find the @$@#^^&%3 report
 [2002-06-29 04:38 UTC] andi@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

We error out now if the same method is declared more than once.
 [2002-06-29 07:26 UTC] andi@php.net
This wasn't really fixed so I'm reopening the bug.

 [2002-07-13 18:29 UTC] derick@php.net
assigning to andi
 [2002-11-10 16:03 UTC] andi@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 21:01:31 2025 UTC