Subquery broken after upgade from 2.6.3 to 2.6.4 #6313

Closed
opened 2026-01-22 15:30:43 +01:00 by admin · 5 comments
Owner

Originally created by @jimiero on GitHub (Sep 29, 2019).

Originally assigned to: @Ocramius on GitHub.

BC Break Report

Q A
BC Break yes
Version x.y.z

Summary

After upgrading to 2.6.4, I get this error:

Notice: Array to string conversion

Previous behavior

Before applying the update it worked just fine.

Current behavior

Now receiving error: Notice: Array to string conversion

How to reproduce

This is the code which was working before:

return $this->getEntityManager()
          ->createQuery(
              'SELECT et
              FROM AppBundle:ArticleType et
              WHERE et.id IN (:ids)'
          )
          ->setParameter('ids', $this->getEntityManager()->getConnection()->fetchAll(
              "SELECT DISTINCT article_type_id FROM articles WHERE active =1 and end_date >= '".date('Y-m-d H:i:s')."'"), Connection::PARAM_INT_ARRAY)
          ->getResult();

with 2.6.4 it returns that error, if I downgrade to 2.6.3 it's just fine.

Is this a bug or the code has to be updated?

Originally created by @jimiero on GitHub (Sep 29, 2019). Originally assigned to: @Ocramius on GitHub. <!-- Before reporting a BC break, please consult the upgrading document to make sure it's not an expected change: https://github.com/doctrine/orm/blob/master/UPGRADE.md --> ### BC Break Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes | Version | x.y.z #### Summary After upgrading to 2.6.4, I get this error: **Notice: Array to string conversion** #### Previous behavior Before applying the update it worked just fine. #### Current behavior Now receiving error: Notice: Array to string conversion #### How to reproduce This is the code which was working before: ``` return $this->getEntityManager() ->createQuery( 'SELECT et FROM AppBundle:ArticleType et WHERE et.id IN (:ids)' ) ->setParameter('ids', $this->getEntityManager()->getConnection()->fetchAll( "SELECT DISTINCT article_type_id FROM articles WHERE active =1 and end_date >= '".date('Y-m-d H:i:s')."'"), Connection::PARAM_INT_ARRAY) ->getResult(); ``` with 2.6.4 it returns that error, if I downgrade to 2.6.3 it's just fine. Is this a bug or the code has to be updated?
admin added the Question label 2026-01-22 15:30:43 +01:00
admin closed this issue 2026-01-22 15:30:43 +01:00
Author
Owner

@Ocramius commented on GitHub (Sep 29, 2019):

You seem to be binding int[][] rather than int[]

@Ocramius commented on GitHub (Sep 29, 2019): You seem to be binding `int[][]` rather than `int[]`
Author
Owner

@jimiero commented on GitHub (Sep 29, 2019):

@Ocramius you mean the code is doing it wrong or is just a bug?

@jimiero commented on GitHub (Sep 29, 2019): @Ocramius you mean the code is doing it wrong or is just a bug?
Author
Owner

@Ocramius commented on GitHub (Sep 29, 2019):

It looks like a bug in yout code, not the ORM. This code was probably never working, but the ORM was silently converting things for you.

@Ocramius commented on GitHub (Sep 29, 2019): It looks like a bug in yout code, not the ORM. This code was probably never working, but the ORM was silently converting things for you.
Author
Owner

@jimiero commented on GitHub (Sep 29, 2019):

@Ocramius any suggestion what to modify to have it working?

@jimiero commented on GitHub (Sep 29, 2019): @Ocramius any suggestion what to modify to have it working?
Author
Owner

@Ocramius commented on GitHub (Sep 29, 2019):

You need to array_column() on the result of your DBAL query.

Closing here meanwhile.

@Ocramius commented on GitHub (Sep 29, 2019): You need to `array_column()` on the result of your DBAL query. Closing here meanwhile.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6313