Where to file a bug report? Or how to submit a fix to the project?

I’ve been working to update a ZF3 application from php 7.1 to go to php 7.4 and switched over to the Laminas project. I ran across some errors in our unit tests that pointed me to this piece of code in ResultSet::Initialize()

if (is_array($dataSource)) {
// its safe to get numbers from an array
$first = current($dataSource);
$this->fieldCount = $first === false ? 0 : count($first);

Consider a dataSource of:
$dataSource = [0 = ‘12345’]

$first will be ‘12345’, and generate an error as that is not a countable object.

Consider a dataSource of:
$dataSource = [0 => [‘1’ => ‘123’, ‘2’ => '123]]

$first will get count() of 2, setting $fieldCount to 2, when the actual value should be 1.

The fix is simple count the $dataSource, not $first:
$this->fieldCount = $first === false ? 0 : count($dataSource);

Best Regards,
Jeff Davis

Welcome to the forums! :smiley:

If you find a bug then you can report it in the issue tracker of laminas-db which can be found at the repository on GitHub: Issues · laminas/laminas-db · GitHub

A fix can be created also on the repository on GitHub. If you can provide an unit test to illustrate the problem then it would help with the processing.

Thank you for your interest and cooperation!

Well after further investigation turned out the above (as I really expected) is not a bug. It was badly formatted test data being used in the unit test causing the problem.