Describe the bug
If setlocale is set to LC_CTYPE variable tr_TR, some of the Turkish characters are different from the en_US definition of PHP's strtolower or strtoupper method.
This character change affects the autoloader configuration of some vendor packages. Smarty for example.
This definition causes Smarty-like Vendor packages to fail to find the classes the autoloaders want to load.
en_US -> Smarty_Internal_Undefined -> smarty_internal_undefined.php
tr_TR -> Smarty_Internal_Undefined -> smarty_谋nternal_undefined.php
To Reproduce
Steps to reproduce the behavior:
We need to change the locale in Debian with tr_TR.UTF-8 to reproduce the issue (tuto followed)
Additional information
PrestaShop version: 1.7.6.2
PHP version: 7.2.x
Solution
https://github.com/PrestaShop/PrestaShop/pull/15991
Hi @metineren,
Thanks for your report.
What the exact error after importing/exporting the Turkish language.
It is ok in my case.
https://drive.google.com/file/d/1AB2lghTsP9T6zSwTbL5-7q3BEW8tg8FV/view
The classic theme exported in Turkish
classic.tr-TR (1).zip
Thanks to check & feedback.
Hi @khouloudbelguith ,
Your server configuration may prevent php from changing the LC_CTYPE parameter in the setlocale function.
can you try this code;
<?php
$current_ctype = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, "tr_TR.UTF-8", "tr_TR.utf8");
$changed_ctype = setlocale(LC_CTYPE, 0);
echo $current_ctype.PHP_EOL; /* Return C */
echo $changed_ctype.PHP_EOL; /* Return tr_TR.UTF-8 */
?>
@metineren,
I have this result
C
C
Thanks!
Then the server's LC_CTYPE parameter prevents you from entering it. In general, changing this parameter is not prohibited on servers.
If your server allowed to modify LC_CTYPE, you would be able to see the error I mentioned.
@metineren, I tried to change my configuration

But it seems ok when Importing the Turkish language.
Thanks!
Hi @khouloudbelguith ,
Can you retest the code I sent in the previous message?
@metineren, it is the same
C C
Thanks!
@khouloudbelguith ,
Looks like your change didn't really apply.
The Turkish language case conversion is different from the English language.
EG: Lowercase to Uppercase: i > 陌, 谋 > I
EG: Uppercase to Lowercase I > 谋, 陌 > i
LC_CTYPE for character classification and conversion, for example strtoupper()
You can see: https://www.php.net/manual/en/function.setlocale.php
Smarty' s autoloader search class name to lowercase if you can set tr_TR to LC_CTYPE in setlocale
The result:
tr_TR -> Smarty_Internal_Undefined -> smarty_谋nternal_undefined.php
Or setlocale LC_CTYPE en_us The result:
en_US -> Smarty_Internal_Undefined -> smarty_internal_undefined.php
And notice: I' am from Turkey and my native language Turkish :)
If you need a server with an unrestricted LC_CTYPE definition to test, I can help if you send a private message.
@metineren,
My address mail: khouloud.[email protected]
Let's be safe!
Thanks!
I' am sended a mail contain test hosting informations
@metineren, thanks!
I will check and feedback.
@metineren, I manage to reproduce the issue with PS1.7.6.2 & PS1.7.5.2.
https://drive.google.com/file/d/1ZDVCjZPQArVqofjSIoFLiQRSPg13yRY5/view
I used my local, it is well configured.
Thanks a lot for your help!
I have this fatal error
Fatal error: Uncaught Error: Class 'Smarty_Internal_Undefined' not found in /projet/1762tr/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php:168 Stack trace: #0 /projet/1762tr/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(277): Smarty_Internal_Extension_Handler->__get('registerPlugin') #1 /projet/1762tr/config/smarty.config.inc.php(125): Smarty_Internal_TemplateBase->registerPlugin('function', 'toolsConvertPri...', Array) #2 /projet/1762tr/config/smartyadmin.config.inc.php(35): smartyRegisterFunction(Object(Smarty), 'function', 'toolsConvertPri...', 'toolsConvertPri...') #3 /projet/1762tr/config/smarty.config.inc.php(57): require_once('/projet/1762tr/...') #4 /projet/1762tr/config/config.inc.php(202): require_once('/projet/1762tr/...') #5 /projet/1762tr/admin/index.php(40): require('/projet/1762tr/...') #6 {main} thrown in /projet/1762tr/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php on line 168
I鈥檒l add this to the debug roadmap.
Thanks!
I have already pull request for this errors. https://github.com/PrestaShop/PrestaShop/pull/15991
With develop branch, after successful install
BO =>

Thanks!
This is better solved upstream -- see https://github.com/smarty-php/smarty/issues/155 for the equivalent issue in Smarty.
Most helpful comment
I have already pull request for this errors. https://github.com/PrestaShop/PrestaShop/pull/15991