I use many functions in my PHP codes like these; UID(), user_getProfileImage() ... etc. I’m writing all my projects on Windows and working well. It’s OK up here but when I put my project on my server it’s giving error like this;
Fatal error: Call to undefined function UID() in /var/www/vhosts/...
What? Is it undefined?!
I’m checking all my project files and FTP’ing all files to server again, again… And same error.
But when I change the name of UID() to uid() (both in lib.php and other places that where it’s used), it’s working well.
So what’s the problem? What’s the matter with this server?
Local PHP vers: 5.3.10
Server PHP info: http://… removed
Note: I’m encoding all PHP files in “UTF-8 without BOM” (as always) with Notepad++, and interestingly the other project is working well even use same functions and run on the same server.
Thanks.
/##############################/
UPDATE (and solution);
- Do not use “I” (capital “i”) character in any function name
or - Simply use setlocale like this;
setlocale(LC_TIME, "tr_TR.UTF-8")// I need just locale time config and used this -
If you need
LC_ALL, do not forget set backLC_CTYPEinen_US, i.e:setlocale(LC_ALL, "tr_TR.UTF-8"); setlocale(LC_CTYPE, "en_US");
This hints at suffering from “the I problem“, which manifests itself when PHP is using a Turkish locale (
tr_TR,tr_TR.utf8…). When doing so, the case-insensitive check between uppercase and lowercase letter “i” fails.See https://bugs.php.net/18556 — “Setting locale to ‘tr_TR’ lowercases class names”
You have a couple of solutions:
The latter is preferred, mostly because it’s usually a one-tiny-change-fixes-all-problems sort of task.