From dc76cfdcf0521552667d44395a2290a5c8e48281 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 29 Feb 2016 22:14:08 +0100 Subject: Fixed 10 "critical" issues found by scrutinizer * create function => closures * removed var_dump from tests --- .../pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php | 11 ++++++++--- .../protected/pages/Controls/Samples/TDataGrid/Sample4.php | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'demos') diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php index aeb30609..827558b8 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php index 201fc5f9..766e4d55 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) -- cgit v1.2.3