Jump to content

Recommended Posts

Hi,

I had problem with Tools::ucwords($str) with czech mb string.

When the $str = 'Jiří'; only 'Ji' is returned and causes error 500 in registration process.

Prestashop ver 1.5.6.0, PHP ver 5.2.10

.

Exceptions log file:

*ERROR*  Property Customer->firstname is not valid at line 837 in file classes/ObjectModel.php

.

Solution: Override Tools method ucwords like this (added encoding):

class Tools extends ToolsCore
{
	public static function ucwords($str, $encoding = 'utf-8')
	{
		if (function_exists('mb_convert_case'))
			return mb_convert_case($str, MB_CASE_TITLE, $encoding);
		return ucwords(strtolower($str));
	}
}

.

Original:

	public static function ucwords($str)
	{
		if (function_exists('mb_convert_case'))
			return mb_convert_case($str, MB_CASE_TITLE);
		return ucwords(strtolower($str));
	}

Tools.php

Edited by humanoidvani (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...