Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

handler class cannot be loaded

Hi, I have weired problem!

I have multilanguage multimodule phalcon mvc system. all langs works well & all controllers & routes ok. but in 2 of langs e.g. 'tr' and 'az', handler class cannot be loaded!

This is so weired that dispatcher looking for indexController instead of IndexController !!!

Client\Controllers\indexController handler class cannot be loaded

when i put indexController.php file with lowercase name, it works! but again for other controllers it looks for lowercase version!


I found the source of problem! when i comment locale part of bootstrap (putenv, bindtextdomain, bind_textdomain_codeset functions), it going to be ok! i dont know why az_AZ or tr_TR make problem! any one knows?


After quick research it turned out that it’s actually known bug, yet still not fixed since 2002! See #18556. In short, PHP simply 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');.

edited Jan '16

use LC_MESSAGES instead of LC_ALL:

setlocale(LC_MESSAGES, "az_AZ.UTF-8");