Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3056

Return value mismatch between code under HHVM and Zend

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
    • Environment:
      Two environments:
      LAMP stack with PHP 5.4.25 on Ubuntu 12.04
      HHVM 3.0.0.-dev (rel) ob Ubuntu 12.04

      Description

      The following code produces differing results under Zend and HHVM runtimes.

      // $all::build uses the query builder to select all entities of a type
      /** @var \Doctrine\ORM\Query $query **/
      $query = $all->build($qb);
      $query->setMaxResults($pageSize)->setFirstResult($start);
      
      $paginator = new Paginator($query);
      $results = array_values((array)$paginator->getIterator());
      

      Under Zend, $results is a 1-dimensional array containing N elements:
      [1, 2, 3].

      Under HHVM, $results is a 2-dimensional array containing a single array, containing N elements:
      [ [1,3,3] ]

        Activity

        Hide
        Christophe Coevoet added a comment -

        I suggest reporting it to the HHVM team as a bug

        Show
        Christophe Coevoet added a comment - I suggest reporting it to the HHVM team as a bug
        Hide
        Marco Pivetta added a comment -

        Also: why are you using an array cast and not iterator_to_array?

        Show
        Marco Pivetta added a comment - Also: why are you using an array cast and not iterator_to_array ?
        Hide
        Christophe Coevoet added a comment -

        @Marco this should be equivalent. Casting a Traversable to array should traverse it. If HHVM does not do it, it is a bug.

        Show
        Christophe Coevoet added a comment - @Marco this should be equivalent. Casting a Traversable to array should traverse it. If HHVM does not do it, it is a bug.
        Hide
        Marco Pivetta added a comment -
        Show
        Marco Pivetta added a comment - Christophe Coevoet not really: http://3v4l.org/Z3t4t
        Hide
        Marco Pivetta added a comment -

        Resolving as invalid: this seems to be a misuse in my opinion.

        Show
        Marco Pivetta added a comment - Resolving as invalid: this seems to be a misuse in my opinion.

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Andy hunt
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: