Skip to content

Control macro is bundling arguments to an array if one of the arguments is an array #1206

@filiplikavcan

Description

@filiplikavcan
# Use case 1 (primitive arguments)

{control aForm, 1, 'foo', true}

# will properly generate 

$_ctrl->render(1, 'foo', true)

The next case should also generate call to render method with three arguments.

# Use case 2 (array argument)
{control aForm, 1, 'foo', array('foo' => 'bar')}

# BUG: the macro will wrap all the arguments into one array:

$_ctrl->render(array(1, 'foo', array('foo' => 'bar'))

This is caused by a condition which determines whether or not to strip the wrapping array just by searching for '=>' substring. This condition covers the use case 3 (bellow) when an implicit array is used as macro argument. However it causes the use case mentioned above not to work properly.

# Use case 3 (implicit array)
{control aForm, 1, 'foo', 'foo' => 'bar'}
...
$_ctrl->render(array(1, 'foo', 'foo' => 'bar'))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions