Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-949

strange behavior with boolean types when using findOneBy() in a CLI phpunit test

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.1, 2.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      I do not see this behavior when running findByOne() calls via the Apache SAPI. No clue really what could possibly cause this. Not sure how to get the error logger to output something in a phpunit test (never really figured out how phpunit supports debugging). Essentially if I run the tests with SQLite the case with 'false' fails and when I run with PostgreSQL the case with 0 fails. Essentially in the fail case I get an instance of $this, just like when I pass: false.

      Tell me if this report is useless in the current state and then I will work on separating it out into a standalone CLI script without Symfony2 and phpunit. But I dont want to spend more time on this if it isnt necessary.

      1. DDC949Test.php
        0.8 kB
        Benjamin Eberlei
      2. DoctrineORMBugTest.php
        4 kB
        Lukas Kahwe

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Cannot reproduce.

        Show
        Benjamin Eberlei added a comment - Cannot reproduce.
        Hide
        Benjamin Eberlei added a comment -

        Attached simpler testcase for reproduce.

        Show
        Benjamin Eberlei added a comment - Attached simpler testcase for reproduce.
        Hide
        Lukas Kahwe added a comment -

        further testing shows this issue only exists with false and there I can reproduce it on the CLI and via apache. it seems I am hitting: http://bugs.php.net/bug.php?id=33876
        however the issue also happens with sqlite for the same reason false gets casted to an empty string when not telling PDO explicitly to handle the parameter as a boolean.

        Show
        Lukas Kahwe added a comment - further testing shows this issue only exists with false and there I can reproduce it on the CLI and via apache. it seems I am hitting: http://bugs.php.net/bug.php?id=33876 however the issue also happens with sqlite for the same reason false gets casted to an empty string when not telling PDO explicitly to handle the parameter as a boolean.
        Hide
        Lukas Kahwe added a comment -

        as explained in the previous comment, the issue is caused by "false" and not by "true" as in the test case.

        Show
        Lukas Kahwe added a comment - as explained in the previous comment, the issue is caused by "false" and not by "true" as in the test case.
        Hide
        Benjamin Eberlei added a comment -

        Fixed.

        This issue occured, because BasicEntityPersister did not pass the PARAM: typehints to the DBAL connection.

        Adding this fixes the issue with Booleans on PostgreSQL, however I just realized it also exists for Oracle OCI and needs an adjustment in DBAL to be fixable.

        Show
        Benjamin Eberlei added a comment - Fixed. This issue occured, because BasicEntityPersister did not pass the PARAM: typehints to the DBAL connection. Adding this fixes the issue with Booleans on PostgreSQL, however I just realized it also exists for Oracle OCI and needs an adjustment in DBAL to be fixable.
        Hide
        Lukas Kahwe added a comment -

        I am also seeing the issue with SQLite.

        Show
        Lukas Kahwe added a comment - I am also seeing the issue with SQLite.
        Hide
        Lukas Kahwe added a comment -

        ok .. i can confirm the issue is fixed on sqlite and postgresql

        Show
        Lukas Kahwe added a comment - ok .. i can confirm the issue is fixed on sqlite and postgresql

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Lukas Kahwe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: