summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-02-29 22:14:08 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-03-29 17:40:11 +0200
commitdc76cfdcf0521552667d44395a2290a5c8e48281 (patch)
treef7f0eea869f1abd47b7a9aa5b3314c617df3dd57
parent0ec0d073c120a2db371dfd4cd6f2a81fd9068676 (diff)
Fixed 10 "critical" issues found by scrutinizer
* create function => closures * removed var_dump from tests
-rwxr-xr-xdemos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php11
-rwxr-xr-xdemos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php11
-rw-r--r--framework/Web/UI/TClientScriptManager.php6
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php1
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php1
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/Callback.php1
-rwxr-xr-xtests/FunctionalTests/tickets/protected/pages/Ticket719.php2
-rw-r--r--tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php1
8 files changed, 20 insertions, 14 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)
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 88e7bb62..5c4d9388 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -400,9 +400,9 @@ class TClientScriptManager extends TApplicationComponent
public function getStyleSheetUrls()
{
$stylesheets = array_values(
- array_map(
- create_function('$e', 'return is_array($e) ? $e[0] : $e;'),
- $this->_styleSheetFiles)
+ array_map(function($e) {
+ return is_array($e) ? $e[0] : $e;
+ }, $this->_styleSheetFiles)
);
foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
index 74113cc8..3657c2a6 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
@@ -5,7 +5,6 @@ class ActiveRadioButtonListTest extends TPage
function list1_callback($sender, $param)
{
$values = $sender->getSelectedValues();
- var_dump($values);
$this->label1->setText("Selection: ".implode(', ', $values));
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
index 1a767b79..ba1b04b2 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
@@ -37,6 +37,5 @@ class AutoCompleteTest extends TPage
function suggestion_selected($sender, $param)
{
- var_dump($param->selectedIndex);
}
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Callback.php b/tests/FunctionalTests/active-controls/protected/pages/Callback.php
index 8a85f50d..85c93f10 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/Callback.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/Callback.php
@@ -6,6 +6,5 @@ class Callback extends TPage
{
function callback1_Requested()
{
- var_dump("ok!");
}
}
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket719.php b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
index 376eecdd..64f8acb2 100755
--- a/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
@@ -24,8 +24,8 @@ class Ticket719 extends TPage
function suggestion_selected($sender, $param)
{
- var_dump($param->selectedIndex);
}
+
public function suggestCountries($sender, $param)
{
$sender->setDataSource($this->matchCountries($param->Token));
diff --git a/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
index 8c6b9789..a472e546 100644
--- a/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
+++ b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
@@ -74,6 +74,5 @@ class ActiveRecordDynamicCallTest extends PHPUnit_Framework_TestCase
function assertDeleteSql($sender, $param)
{
- var_dump($param);
}
}