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

[BUG]: Column '0' is not part of the column map. After iterating for the second time in a Resultset #16467

Closed
JoaoSetas opened this issue Nov 21, 2023 · 3 comments · Fixed by #16468
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@JoaoSetas
Copy link

JoaoSetas commented Nov 21, 2023

We have a problem in our project since the upgrade from phalcon 3.4.5 to the latest version 5.4.0.
When using the \Phalcon\Mvc\Model\Query\Builder in any of our models we have the same issue after iterating the second time over the ResultSet we get the error Column '0' is not part of the column map when doing toArray() in that result set.

To Reproduce

Code example of bug:

$result = $models_manager
    ->createBuilder()
    ->addFrom(Products::class, 'p')
    ->limit(10)
    ->getQuery()
    ->execute();

foreach ($result as $value) {}
foreach ($result as $value) {}

$result->toArray();  // Error here - `Column '0' is not part of the column map` 

We can also reproduce the error like this.

$result = $models_manager
    ->createBuilder()
    ->addFrom(Products::class, 'p')
    ->limit(10)
    ->getQuery()
    ->execute();

$result->rewind();
$result->next();
dump($result);
$result->rewind();
dump($result); exit;

We notice that in the second dump, the property row has more properties and with the wrong indexs.

Screenshots
First dump:
image

Second dump:
image

Details

  • Phalcon version: 5.4.0
  • PHP Version: 8.1.25
  • Operating System: Docker image - php:8.1-fpm
  • Installation type: installing via package manager
  • Server: Nginx
  • Database: mysql:8
@JoaoSetas JoaoSetas added bug A bug report status: unverified Unverified labels Nov 21, 2023
@dfernandesbsolus
Copy link

I have the same problem :(

@apoca
Copy link

apoca commented Nov 21, 2023

Same problem here!!!

@niden niden self-assigned this Nov 23, 2023
@niden niden added status: medium Medium 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Nov 23, 2023
@niden niden mentioned this issue Nov 23, 2023
5 tasks
@niden niden linked a pull request Nov 23, 2023 that will close this issue
5 tasks
@niden
Copy link
Sponsor Member

niden commented Nov 23, 2023

Resolved in #16468

Thank you @JoaoSetas @dfernandesbsolus and @apoca for reporting this

@niden niden closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

4 participants