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);
setlocale(LC_TIME, "tr_TR.UTF-8") // I need just locale time config and used thisIf you need LC_ALL, do not forget set back LC_CTYPE in en_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.
It’s actually known bug, yet still not fixed since 2002! See #18556.
In short, PHP uses internal tolower() function, which is locale-aware, but in Turkish there are some specific rules for I (undotted ı is the lowercase of I, and the dotted İ is the uppercase of i). So if you have class name of method name having upper I (newInstanceArgs, Image, etc), you’re affected.
The only workaround for now seems to be setting LC_CTYPE to some working locale, eg.
setlocale(LC_ALL, 'tr_TR');
setlocale(LC_CTYPE, 'en_US');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With