Open beeyev opened 1 year ago
Are we sure it's not returning NULL, when nothing is found?
Yes,
Original ZF1 repo also has array
as only one return type:
https://github.com/zendframework/zf1/blob/136735e776f520b081cd374012852cb88cef9a88/library/Zend/Db/Statement/Interface.php#L134
I seem to recall it returning NULL when there are no rows, instead of an empty array. Though for some reason, that doesn't always happen... I think (but haven't fully tested this) this seems to happen only when the query features only aggregate functions, and maybe only on MySQL. A normal query like "SELECT * FROM table WHERE myColumn = 'non-existent-value'" would still return an empty array either way.
Either way, the doc block is a reflection of this reality, rather than trying to fix the method to fallback to an empty array in those cases.
According to the interface https://github.com/Shardj/zf1-future/blob/master/library/Zend/Db/Statement/Interface.php#L134 Method
fetchAll
should always returnarray
But in the abstraction class https://github.com/Shardj/zf1-future/blob/master/library/Zend/Db/Adapter/Abstract.php#L731 there is a union with null, which is incorrect