FIX list of module not complete when module mb_strlen not available

Conflicts:
	dev/dolibarr_changes.txt
This commit is contained in:
Laurent Destailleur 2017-11-25 02:32:25 +01:00
parent 4cbcf5189a
commit 61798d1af0
2 changed files with 21 additions and 4 deletions

View File

@ -111,3 +111,16 @@ to get
if ($className == 'Luracast\Restler\mixed') return; if ($className == 'Luracast\Restler\mixed') return;
... ...
PARSEDOWN
---------
* Fix to avoid fatal error when mb_strlen not available:
// @CHANGE LDR Fix when mb_strlen is not available
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
else $len = strlen($line);
$shortage = 4 - $len % 4;

View File

@ -141,7 +141,11 @@ class Parsedown
foreach ($parts as $part) foreach ($parts as $part)
{ {
$shortage = 4 - mb_strlen($line, 'utf-8') % 4; // @CHANGE LDR Fix when mb_strlen is not available
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
else $len = strlen($line);
$shortage = 4 - $len % 4;
$line .= str_repeat(' ', $shortage); $line .= str_repeat(' ', $shortage);
$line .= $part; $line .= $part;