Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release 2.15.1 into 2.16.x #265

Merged
merged 2 commits into from
Dec 5, 2022

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Dec 5, 2022

Release Notes for 2.15.1

2.15.x bugfix release (patch)

2.15.1

  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1

Bug

Ocramius and others added 2 commits December 5, 2022 19:14
…iven to `Predicate#expression()`

Around `laminas/laminas-db:2.10.1`, a regression was introduced, in which calling
`Laminas\Db\Sql\Predicate#expression("an_expression()")` led to crashes like following
in downstream consumers:

```
Laminas\Db\Sql\Exception\RuntimeException: The number of replacements in the expression does not match the number of parameters

vendor/laminas/laminas-db/src/Sql/Expression.php:151
vendor/laminas/laminas-db/src/Sql/Predicate/PredicateSet.php:178
vendor/laminas/laminas-db/src/Sql/Predicate/PredicateSet.php:178
vendor/laminas/laminas-db/src/Sql/Predicate/PredicateSet.php:178
vendor/laminas/laminas-db/src/Sql/AbstractSql.php:129
vendor/laminas/laminas-db/src/Sql/Select.php:633
```

This was because predicates were initialized with an `array{null}` by
default, when expressions like `$sql->where->expression("some_expression()")`
were used.

The usage of `$sql->where->expression("some_expression()", "foo")` remains
unchanged with this patch.

This fix targets `2.15.x`, and attempts to make predicates safe to use when no
parameters have been given.

While an existing test has indeed been changed, this shouldn't have any effect for
downstream consumers, since `Predicate#expression(string)` didn't work (so far)
anyway, due to the kind of crash highlighted above.
…d-not-have-values-to-be-bound-when-none-given

Fix: prevent bound parameters being `[null]` when no parameters are given to `Predicate#expression()`
@Ocramius Ocramius added the Bug Something isn't working label Dec 5, 2022
@Ocramius Ocramius added this to the 2.16.1 milestone Dec 5, 2022
@Ocramius Ocramius self-assigned this Dec 5, 2022
@Ocramius Ocramius merged commit 2bdc91a into 2.16.x Dec 5, 2022
@Ocramius Ocramius deleted the 2.15.x-merge-up-into-2.16.x_PbtaJlbN branch December 5, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant