You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: getObjectGraph warning for multiple instances is unreachable #293
xPDO::getObjectGraph() contains a condition that can never be true, so its "criteria returned more than one instance" warning is unreachable. When criteria match several rows, the method silently returns the first object.
Steps to Reproduce
Build a query whose criteria match more than one object.
A warning when criteria match more than one instance.
Actual / Observed Behavior
src/xPDO/xPDO.php:1088 uses if (!count($collection) === 1), which is always false because !count(...) is a boolean compared to the integer 1. reset($collection) on line 1091 then returns the first object with no warning.
Environment
xPDO Version: 3.2.0, commit e0d7dfd6c58e38767094aff1bc049d7694a05735
PHP Version: not provided (report based on source review)
Database: not applicable
Activity