TYPO3 Flow Base DistributionPackagesApplications

Bug #47727

Array merge in Workflow works not as expected

Added by Joachim Mathes over 2 years ago. Updated about 2 years ago.

Status:New Start date:2013-04-30
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-

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().

History

#1 Updated by Irene Höppner about 2 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