diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-02-29 22:14:08 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-03-29 17:40:11 +0200 |
commit | dc76cfdcf0521552667d44395a2290a5c8e48281 (patch) | |
tree | f7f0eea869f1abd47b7a9aa5b3314c617df3dd57 /demos | |
parent | 0ec0d073c120a2db371dfd4cd6f2a81fd9068676 (diff) |
Fixed 10 "critical" issues found by scrutinizer
* create function => closures
* removed var_dump from tests
Diffstat (limited to 'demos')
-rwxr-xr-x | demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php | 11 | ||||
-rwxr-xr-x | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php | 11 |
2 files changed, 16 insertions, 6 deletions
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) |