Skip to content

[5.4] Null return in a model relation with a id=0 key in DB table #17669

Closed
@neoteknic

Description

@neoteknic
  • Laravel Version: 5.4.6
  • PHP Version: 7.1.1
  • Database Driver & Version: MariaDB 10.1.20

Description:

Eloquent relation return null instead of model when the id key in the database table is 0 (for non auto-increment table), it works fine in 5.2/5.3.

Steps To Reproduce:

Use a relation like belongTo in a model, submodel have key like id 0,1,2 if key = 0 the relation return null instead of returning the submodel .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions