mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 11:21:42 +02:00
Revert "simpler way to un-reference the rows and some docu why we have to"
This reverts commit f89f08a8eda1720895c8ffd1a3cc5a1a2779e842.
This commit is contained in:
parent
f89f08a8ed
commit
9ff814f5b4
@ -203,12 +203,9 @@ class Etemplate extends Etemplate\Widget\Template
|
|||||||
|
|
||||||
if($data['content']['nm']['rows'] && is_array($data['content']['nm']['rows']))
|
if($data['content']['nm']['rows'] && is_array($data['content']['nm']['rows']))
|
||||||
{
|
{
|
||||||
// Api\Storage::search() returns (historically) a reference!
|
// Deep copy rows so we don't lose them when request is set to null
|
||||||
// We need to un-reference the rows here, so they are not lost,
|
// (some content by reference)
|
||||||
// if we have to set self::$request=null; to force the destructor.
|
$data['content']['nm'] = self::deep_copy($data['content']['nm']);
|
||||||
$rows = $data['content']['nm'];
|
|
||||||
unset($data['content']['nm']);
|
|
||||||
$data['content']['nm'] = $rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info required to load the etemplate client-side
|
// Info required to load the etemplate client-side
|
||||||
@ -254,8 +251,7 @@ class Etemplate extends Etemplate\Widget\Template
|
|||||||
|
|
||||||
// Really important to run this or weird things happen
|
// Really important to run this or weird things happen
|
||||||
// See https://help.egroupware.org/t/nextmatch-wert-im-header-ausgeben/73412/11
|
// See https://help.egroupware.org/t/nextmatch-wert-im-header-ausgeben/73412/11
|
||||||
// this forces the constructor to run immediatly, while it otherwise would run to late by the garbadge collector
|
self::$request=null;
|
||||||
self::$request = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// let framework know, if we are a popup or not ('popup' not true, which is allways used by index.php!)
|
// let framework know, if we are a popup or not ('popup' not true, which is allways used by index.php!)
|
||||||
@ -639,6 +635,36 @@ class Etemplate extends Etemplate\Widget\Template
|
|||||||
return $old;
|
return $old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deep copy array to make sure there are no references
|
||||||
|
*
|
||||||
|
* @param Array $array
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
public static function deep_copy($source)
|
||||||
|
{
|
||||||
|
$arr = array();
|
||||||
|
|
||||||
|
foreach ($source as $key => $element)
|
||||||
|
{
|
||||||
|
if (is_array($element))
|
||||||
|
{
|
||||||
|
$arr[$key] = static::deep_copy($element);
|
||||||
|
}
|
||||||
|
else if (is_object($element))
|
||||||
|
{
|
||||||
|
// make an object copy
|
||||||
|
$arr[$key] = clone $element;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$arr[$key] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug callback just outputting content
|
* Debug callback just outputting content
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user