DDC-949: strange behavior with boolean types when using findOneBy() in a CLI phpunit test #1179

Closed
opened 2026-01-22 13:04:53 +01:00 by admin · 9 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 25, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @lsmith77:

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.

Originally created by @doctrinebot on GitHub (Dec 25, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @lsmith77: 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.
admin added the Bug label 2026-01-22 13:04:53 +01:00
admin closed this issue 2026-01-22 13:04:55 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 28, 2010):

Comment created by @beberlei:

Cannot reproduce.

@doctrinebot commented on GitHub (Dec 28, 2010): Comment created by @beberlei: Cannot reproduce.
Author
Owner

@doctrinebot commented on GitHub (Dec 28, 2010):

Comment created by @beberlei:

Attached simpler testcase for reproduce.

@doctrinebot commented on GitHub (Dec 28, 2010): Comment created by @beberlei: Attached simpler testcase for reproduce.
Author
Owner

@doctrinebot commented on GitHub (Dec 28, 2010):

Comment created by @lsmith77:

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.

@doctrinebot commented on GitHub (Dec 28, 2010): Comment created by @lsmith77: 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.
Author
Owner

@doctrinebot commented on GitHub (Jan 1, 2011):

Comment created by @lsmith77:

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

@doctrinebot commented on GitHub (Jan 1, 2011): Comment created by @lsmith77: as explained in the previous comment, the issue is caused by "false" and not by "true" as in the test case.
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2011):

Comment created by @beberlei:

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.

@doctrinebot commented on GitHub (Jan 2, 2011): Comment created by @beberlei: 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.
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jan 2, 2011): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2011):

Comment created by @lsmith77:

I am also seeing the issue with SQLite.

@doctrinebot commented on GitHub (Jan 2, 2011): Comment created by @lsmith77: I am also seeing the issue with SQLite.
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2011):

Comment created by @lsmith77:

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

@doctrinebot commented on GitHub (Jan 2, 2011): Comment created by @lsmith77: ok .. i can confirm the issue is fixed on sqlite and postgresql
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 2 attachments from Jira into https://gist.github.com/8e1cc73065be95be26a6

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 2 attachments from Jira into https://gist.github.com/8e1cc73065be95be26a6 - [10898_DoctrineORMBugTest.php](https://gist.github.com/8e1cc73065be95be26a6#file-10898_DoctrineORMBugTest-php) - [10901_DDC949Test.php](https://gist.github.com/8e1cc73065be95be26a6#file-10901_DDC949Test-php)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1179