aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-01-09 16:31:56 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-01-09 16:44:10 -0600
commit445667a62e80c42b5406c981d1116ef99a23df3b (patch)
tree1f00f5c0a3aa805eefe9aecb50c7fa164c6534c4 /phpBB
parentf56e400cd36b6d17ffde90a91e6e221cb83d2dbd (diff)
downloadforums-445667a62e80c42b5406c981d1116ef99a23df3b.tar
forums-445667a62e80c42b5406c981d1116ef99a23df3b.tar.gz
forums-445667a62e80c42b5406c981d1116ef99a23df3b.tar.bz2
forums-445667a62e80c42b5406c981d1116ef99a23df3b.tar.xz
forums-445667a62e80c42b5406c981d1116ef99a23df3b.zip
[feature/migrations] Fix if method (and create a test for it)
PHPBB3-9737
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/db/migrator.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/phpBB/includes/db/migrator.php b/phpBB/includes/db/migrator.php
index 5d8dc12f58..1042b767e8 100644
--- a/phpBB/includes/db/migrator.php
+++ b/phpBB/includes/db/migrator.php
@@ -364,6 +364,12 @@ class phpbb_db_migrator
protected function run_step($step, $last_result = false)
{
$callable_and_parameters = $this->get_callable_from_step($step, $last_result);
+
+ if ($callable_and_parameters === false)
+ {
+ return;
+ }
+
$callable = $callable_and_parameters[0];
$parameters = $callable_and_parameters[1];
@@ -377,7 +383,7 @@ class phpbb_db_migrator
* @param mixed $last_result Result to pass to the callable (only for 'custom' method)
* @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters
*/
- public function get_callable_from_step($step, $last_result = false)
+ protected function get_callable_from_step($step, $last_result = false)
{
$type = $step[0];
$parameters = $step[1];
@@ -406,6 +412,12 @@ class phpbb_db_migrator
}
$condition = $parameters[0];
+
+ if (!$condition)
+ {
+ return false;
+ }
+
$step = $parameters[1];
$callable_and_parameters = $this->get_callable_from_step($step);
@@ -413,10 +425,8 @@ class phpbb_db_migrator
$sub_parameters = $callable_and_parameters[1];
return array(
- function ($condition) use ($callable, $sub_parameters) {
- return call_user_func_array($callable, $sub_parameters);
- },
- array($condition),
+ $callable,
+ $sub_parameters,
);
break;
case 'custom':