Skip to content

Commit

Permalink
FIX list of module not complete when module mb_strlen not available
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 25, 2017
1 parent 88841cc commit bdecef5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
15 changes: 15 additions & 0 deletions dev/dolibarr_changes.txt
Expand Up @@ -128,3 +128,18 @@ Change also file Luracast/Restler/explorer/index.html
// @CHANGE LDR
if (! is_string($className)) return;
//var_dump($className);



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;


10 changes: 7 additions & 3 deletions htdocs/includes/parsedown/Parsedown.php
Expand Up @@ -141,7 +141,11 @@ protected function lines(array $lines)

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 .= $part;
Expand Down Expand Up @@ -515,10 +519,10 @@ protected function blockList($Line)
),
);

if($name === 'ol')
if($name === 'ol')
{
$listStart = stristr($matches[0], '.', true);

if($listStart !== '1')
{
$Block['element']['attributes'] = array('start' => $listStart);
Expand Down

0 comments on commit bdecef5

Please sign in to comment.