BasicEntityPersister::count() return type contract violation in 2.5.x branch #5758

Closed
opened 2026-01-22 15:16:56 +01:00 by admin · 1 comment
Owner

Originally created by @vkurdin on GitHub (Nov 3, 2017).

Originally assigned to: @lcobucci on GitHub.

There is a return type contract violation in stable 2.5.x branch for count() method in BasicEntityPersister class: string returned instead of integer
e1b851f2e9/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php (L811-L824)

causing incorrect behavior in case like:

/** @var $coll Doctrine\ORM\LazyCriteriaCollection */
if ($coll->count() === 0) {
  // unreachable code
}

it seems to be fixed as a collateral change in master and needs to be backported somehow:
a90035e81a (diff-25f5292f65d5536bb733559f15e0d37fR825)

Originally created by @vkurdin on GitHub (Nov 3, 2017). Originally assigned to: @lcobucci on GitHub. There is a return type contract violation in stable 2.5.x branch for `count()` method in `BasicEntityPersister` class: string returned instead of integer https://github.com/doctrine/doctrine2/blob/e1b851f2e93a4afd82fb7e7f32c6f114d0ea7b71/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php#L811-L824 causing incorrect behavior in case like: ```php /** @var $coll Doctrine\ORM\LazyCriteriaCollection */ if ($coll->count() === 0) { // unreachable code } ``` it seems to be fixed as a collateral change in `master` and needs to be backported somehow: https://github.com/doctrine/doctrine2/commit/a90035e81af2e9a424c0268a36101c3483e06571#diff-25f5292f65d5536bb733559f15e0d37fR825
admin closed this issue 2026-01-22 15:16:56 +01:00
Author
Owner

@lcobucci commented on GitHub (Nov 27, 2017):

Handled via #6818

@lcobucci commented on GitHub (Nov 27, 2017): Handled via #6818
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5758