DDC-1967: mysql Tiny ints not behaving properley #2482

Closed
opened 2026-01-22 13:54:55 +01:00 by admin · 7 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 4, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user jonathanpete:

If I set up a field as a tinyint lets say called bob. I then extract a record.

If I do $object->getBob() - when bob = 1, everything works fine.

However, if I do $object->getBob() when bob = 0, the null value is returned.

If bob is null, everything works fine.

This issues only seems to happen with mysql tinyint.

Originally created by @doctrinebot on GitHub (Aug 4, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user jonathanpete: If I set up a field as a tinyint lets say called bob. I then extract a record. If I do $object->getBob() - when bob = 1, everything works fine. However, if I do $object->getBob() when bob = 0, the null value is returned. If bob is null, everything works fine. This issues only seems to happen with mysql tinyint.
admin added the Bug label 2026-01-22 13:54:55 +01:00
admin closed this issue 2026-01-22 13:54:55 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 14, 2012):

Comment created by @asm89:

I guess it is 'false' that is being returned? That's because MySql's tinyint will be mapped as boolean (by doctrine dbal).

@doctrinebot commented on GitHub (Aug 14, 2012): Comment created by @asm89: I guess it is 'false' that is being returned? That's because MySql's tinyint will be mapped as boolean (by doctrine dbal).
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2012):

Comment created by jonathanpete:

No. The value "" is returned as in an empty string.

@doctrinebot commented on GitHub (Aug 28, 2012): Comment created by jonathanpete: No. The value "" is returned as in an empty string.
Author
Owner

@doctrinebot commented on GitHub (Aug 29, 2012):

Comment created by @beberlei:

can you show your mapping for this value?

@doctrinebot commented on GitHub (Aug 29, 2012): Comment created by @beberlei: can you show your mapping for this value?
Author
Owner

@doctrinebot commented on GitHub (Oct 9, 2012):

Comment created by jonathanpete:

Sure. Mapping is:

/****
 * @var boolean $isvegetarian
 *
 * @Column(name="IsVegetarian", type="boolean", nullable=true)
 */
private $isvegetarian;

DBAL maps field as a tiny int. If I manually set field to 0, DBAL returns null. If I set to null, DBAL returns null. If I set to 1, DBAL returns true.

@doctrinebot commented on GitHub (Oct 9, 2012): Comment created by jonathanpete: Sure. Mapping is: ``` /**** * @var boolean $isvegetarian * * @Column(name="IsVegetarian", type="boolean", nullable=true) */ private $isvegetarian; ``` DBAL maps field as a tiny int. If I manually set field to 0, DBAL returns null. If I set to null, DBAL returns null. If I set to 1, DBAL returns true.
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2012):

Comment created by jonathanpete:

I installed the new version, then reverted back and the problem seems to have gone away. I'm very confused!! Perhaps it was an installation problem at my end. But can't think what. Oh well...

@doctrinebot commented on GitHub (Oct 10, 2012): Comment created by jonathanpete: I installed the new version, then reverted back and the problem seems to have gone away. I'm very confused!! Perhaps it was an installation problem at my end. But can't think what. Oh well...
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2012):

Comment created by jonathanpete:

nope, i'm wrong. it is a bug - something else fooled me into thinking it was working. I have tried setting up other boolean data fields and the same issue occurs.

@doctrinebot commented on GitHub (Oct 10, 2012): Comment created by jonathanpete: nope, i'm wrong. it is a bug - something else fooled me into thinking it was working. I have tried setting up other boolean data fields and the same issue occurs.
Author
Owner

@doctrinebot commented on GitHub (Oct 10, 2012):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Oct 10, 2012): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2482