ZF2-514: Fatal error thrown when accessing merge method on non-existing object

Description

A fatal error is thrown on line 576 of \Zend\Db\Sql\Select.php when trying to use Expr in a join, such as:


->join(
    array('u' => 'users'),
    'othertable.originator_id = u.id',
    array('person' => new Expr("IF(u.id = 1, NULL, u.username)"))
)

Comments

Forgot to mention that line 576 just needs to have a check for $parameterContainer being non-empty, such as:


if ($parameterContainer) {
    $parameterContainer->merge($jColumnParts->getParameterContainer());
}

Send a pull request for this: https://github.com/zendframework/zf2/pull/2291

Fixed with @koen's patch.