Bug #47727

Array merge in Workflow works not as expected

Added by Joachim Mathes over 8 years ago. Updated over 8 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Target version:
-
Start date:
2013-04-30
Due date:
% Done:

0%

Estimated time:

Description

The method setTaskOptions() uses array_merge_recursive() to merge previously set options with current ones. The PHP documentation says: If the input arrays have the same string keys, then the values for these keys are merged together into an array. Thus, if you have more than one Application to deploy, options like typo3.surf:gitcheckout will be set like this:

array(3) {
  ["sha1"]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  ["tag"]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  ["branch"]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
}

This will lead to an error in the gitcheckout task, eventually.

In my opinion setTaskOptions() should use PHP function array_replace_recursive().

#1

Updated by Irene Höppner over 8 years ago

The reason for this can be found in the BaseApplication.

Here the options array values for the gitcheckout-Task are set to NULL, which causes the described problems with array_merge_recursive(). See also http://de1.php.net/manual/de/function.array-merge-recursive.php#109285.

You can workaround the problem by setting these options via the application:

$application->setOption('git-checkout-tag', '...');
$application->setOption('git-checkout-sha1', '...');
$application->setOption('git-checkout-branch', '...');

Having a look at the examples on php.net I don't think array_replace_recursive() is a good idea because previously set options might be overriden then.

Will add a patch for the BaseApplication.

Also available in: Atom PDF