Fix php 7.2

This commit is contained in:
Laurent Destailleur
2017-06-20 00:50:30 +02:00
parent 3717a01641
commit eef5df583e
2 changed files with 8 additions and 7 deletions

View File

@@ -49,12 +49,15 @@ function dol_json_encode($elements)
{
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
$num=count($elements);
$num=0;
if (is_object($elements)) // Count number of properties for an object
{
$num=0;
foreach($elements as $key => $value) $num++;
}
else
{
$num=count($elements);
}
//var_dump($num);
// determine type

View File

@@ -167,7 +167,5 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
$objecttotest->property3=$now;
$encoded=dol_json_encode($objecttotest);
$this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}',$encoded);
}
}