2
0
forked from Wavyzz/dolibarr

Prepare fix #yogosha6443

This commit is contained in:
Laurent Destailleur
2021-06-30 17:14:19 +02:00
parent 7c2121c439
commit bda36337cd
14 changed files with 78 additions and 238 deletions

View File

@@ -993,7 +993,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
function dol_clone($object, $native = 0)
{
if (empty($native)) {
$myclone = unserialize(serialize($object));
$myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
} else {
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable)
}
@@ -10301,9 +10301,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
*/
function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{
/*
global $conf;
/*if (!empty($conf->dol_no_mouse_hover)) {
if (!empty($conf->dol_no_mouse_hover)) {
$showonlyonhover = 0;
}*/
@@ -10315,3 +10316,19 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
return $result;
}
/**
* Decode an encode string. The string can be encoded in json format (recommended) or with serialize (avoid this)
*
* @param string $stringtodecode String to decode (json or serialize coded)
*/
function jsonOrUnserialize($stringtodecode)
{
$result = json_decode($stringtodecode);
if ($result === null) {
$result = unserialize($stringtodecode);
}
return $result;
}