php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55210 Certain function names are changed into lowercase....
Submitted: 2011-07-14 17:47 UTC Modified: 2011-07-15 12:08 UTC
From: yurtesen at ispro dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.6 OS: FreeBSD 8.2-STABLE
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: yurtesen at ispro dot net
New email:
PHP Version: OS:

 

 [2011-07-14 17:47 UTC] yurtesen at ispro dot net
Description:
------------
Actually, I am not sure how to track this problem since I couldnt replicate it using a simple test case.

I use a software which has a pile of user functions.

It loads a common file in each page using require_once()

first page loads -> actual page   (and both loads the common php file)

This common file have function definitions.


The problem is that there is a function in the common file which has name getUserID() and it is possible to call this function from the 'first' page, but when one tries to call it from the 'actual' page you get an undefined function error. (yes the require_once for the common page is on the top!).

After much research, I found out that somehow PHP changed the function name into lowercase.

As a side note, this used to function fine in PHP 5.3.2 and FreeBSD 7.x, I upgraded to FreeBSD 8.x and PHP 5.3.6 (with same configurations) and the problem occured.

I can copy/paste the function into the 'actual' file and PHP does not complain about it being redefined (and actually it becomes usable again).



Test script:
---------------
Below is output of (note that the getUserID is double):

print_r(get_defined_functions());


    [user] => Array
        (
            [0] => getvariables
            [1] => isempty
            [2] => checkpwd
            [3] => userexists
            [4] => iscookieset
            [5] => checkuser
            [6] => gettotalusers
            [7] => gettotaladmins
            [8] => gettotalsupporters
            [9] => getuserinfo
            [10] => listmembers
            [11] => getannouncements
            [12] => getuserlist
            [13] => getuserid
            [14] => getgroupid
            [15] => getgroupname
            [16] => groupexists
            [17] => getpriority
            [18] => getstatus
            [19] => issupporter
            [20] => isadministrator
            [21] => getsgroup
            [22] => getgrouplist
            [23] => getugrouplist
            [24] => ingroup
            [25] => getugroup
            [26] => getmessage
            [27] => printerror
            [28] => printsuccess
            [29] => getrank
            [30] => getrpriority
            [31] => getrstatus
            [32] => gethighestrank
            [33] => getlowestrank
            [34] => getsecondstatus
            [35] => getsecondpriority
            [36] => getprioritylist
            [37] => getcategorylist
            [38] => getstatuslist
            [39] => createheader
            [40] => creategroupmenu
            [41] => createprioritymenu
            [42] => createstatusmenu
            [43] => createthememenu
            [44] => createlanguagemenu
            [45] => createtimeoffsetmenu
            [46] => displayticket
            [47] => createticketinfo
            [48] => createcategorymenu
            [49] => createkcategorymenu
            [50] => createplatformmenu
            [51] => updatelog
            [52] => getcurrentlog
            [53] => deletefromgroups
            [54] => gettotalnumopentickets
            [55] => gettotalnumclosedtickets
            [56] => gettotalnumtickets
            [57] => validemail
            [58] => starttable
            [59] => endtable
            [60] => sendmail
            [61] => getemailaddress
            [62] => showformattedtime
            [63] => listplatforms
            [64] => getnumplatforms
            [65] => listkcategories
            [66] => getnumkcategories
            [67] => createkbmenu
            [68] => makeclickable
            [69] => setresponse
            [70] => createviewablebymenu
            [71] => convertfilesize
            [72] => getlanguage
            [73] => createsgroupcheckboxes
            [74] => createugroupcheckboxes
            [75] => gettimeoffset
            [76] => getlastactivetime
            [77] => stripscripts
            [78] => getdefaultsupportergroupid
            [79] => getthemevars
            [80] => getthemename
            [81] => listopentickets
            [82] => getsgrouplist
            [83] => listbypriority
            [84] => listbystatus
            [85] => getnumbergroups
            [86] => getuserinfo
            [87] => getuserid
            [88] => getgroupid
            [89] => createticketinfo
            [90] => getdefaultsupportergroupid
        )

Expected result:
----------------
I expect that function names do not change into lowercase when used inside a file which was loaded by require() 

And, I tried to test this with a small test case, but PHP worked fine, any hints on how to debug the issue?

I didnt re-test installing PHP 5.3.2 yet.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-15 11:46 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2011-07-15 11:46 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP is handling function names case-insensitive, for that we need the lower-case version in most places.
 [2011-07-15 12:06 UTC] yurtesen at ispro dot net
If the name handling is case-insensitive, how can get_defined_functions() can return same function twice? See array elements 13 and 87. Shouldnt it say that the function was already defined in such case? (because I could define the function twice! see below)


Why it accepts getUserID() and also accept getuserid() in one file and in another file which was included from that specific file I can use only getuserid() BUT not getUserID() anymore?


As a matter of fact, when this happens, I can redefine getUserID function and that is why it appears twice in the defined functions list....


If there truly was not a problem, any of these shouldnt happen?


Interesting enough, only some certain functions seem to be effected seemingly randomly... If you have a clever idea of what I might try to figure out what is happening, please let me know...
 [2011-07-15 12:08 UTC] yurtesen at ispro dot net
Also, why it accepts getuserid() and not getUserID() anymore all of a sudden?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 06:01:34 2025 UTC