Skip to content

Commit 0971b8c

Browse files
committed
Merge pull request AliHichem#131 from zgoniaiko/fix-event-listener
Fix warning in case session data not exist
2 parents 0501c24 + e9d414b commit 0971b8c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

EventListener/DatatableListener.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ protected function _injectDatatableScript(Response $response, Request $request)
6868
$pos_container = strripos($content, 'alidatatable-scripts');
6969
$sess_dta = $session->get('datatable',array());
7070
$dta_script = null;
71-
array_walk($sess_dta, function(&$part, &$key) {
72-
$part = trim(preg_replace('/\s\s+/', ' ', $part));
73-
});
74-
$dta_script = implode("\n", $sess_dta);
71+
if ($sess_data)
72+
{
73+
array_walk($sess_dta, function(&$part, &$key) {
74+
$part = trim(preg_replace('/\s\s+/', ' ', $part));
75+
});
76+
$dta_script = implode("\n", $sess_dta);
77+
}
7578
$session->set('datatable', array());
7679
if (!$pos_container)
7780
{

0 commit comments

Comments
 (0)