Bug when deserializing ?string 7.4-hinted properties. #9

Closed
opened 2026-01-24 11:24:45 +01:00 by admin · 5 comments
Owner

Originally created by @signor-pedro on GitHub (Mar 23, 2020).

Hi, anyone seeing a weird bug after composer update today?

If my column in DB is a nullable string and set to null, Doctrine does not hydrate the property with null but “ignores” the property altogether, which results in
Typed property ... must not be accessed before initialization
Started happening today after composer update.

dbb
See element 0 of array - it is missing event property altogether.
It did not happen yesterday, yesterday it was hydrated normally null as you would expect.

@beberlei

Originally created by @signor-pedro on GitHub (Mar 23, 2020). Hi, anyone seeing a weird bug after composer update today? If my column in DB is a nullable string and set to null, Doctrine does not hydrate the property with null but “ignores” the property altogether, which results in ```Typed property ... must not be accessed before initialization``` Started happening today after composer update. ![dbb](https://user-images.githubusercontent.com/53906348/77309922-bce6f600-6cfd-11ea-94d7-d6b1faff49b3.png) See element 0 of array - it is missing event property altogether. It did not happen yesterday, yesterday it was hydrated normally `null` as you would expect. @beberlei
admin added the Bug label 2026-01-24 11:24:45 +01:00
admin closed this issue 2026-01-24 11:24:45 +01:00
Author
Owner

@marforon commented on GitHub (Mar 23, 2020):

I have the same issue, I believe it's related to this cd4811c644.

@marforon commented on GitHub (Mar 23, 2020): I have the same issue, I believe it's related to this https://github.com/doctrine/reflection/pull/35/commits/cd4811c644b8bcbf508367145573c5fd392b82a6.
Author
Owner

@beberlei commented on GitHub (Mar 23, 2020):

The property is declared as Nullable? Weird only non nullable properties should use the class, maybe i am wrong and its all typed classes, then we need to check for allowsnull

@beberlei commented on GitHub (Mar 23, 2020): The property is declared as Nullable? Weird only non nullable properties should use the class, maybe i am wrong and its all typed classes, then we need to check for allowsnull
Author
Owner

@signor-pedro commented on GitHub (Mar 23, 2020):

Yes, it is declared as nullable, for reference:

/**
 * Fails
 * @ORM\Column(type="string", length=100, nullable=true)
 */
private ?string $event;

/**
* Works
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $event;
@signor-pedro commented on GitHub (Mar 23, 2020): Yes, it is declared as nullable, for reference: ``` /** * Fails * @ORM\Column(type="string", length=100, nullable=true) */ private ?string $event; /** * Works * @ORM\Column(type="string", length=100, nullable=true) */ private $event; ```
Author
Owner

@ondrejmirtes commented on GitHub (Mar 25, 2020):

I agree, I have the same problem.

@ondrejmirtes commented on GitHub (Mar 25, 2020): I agree, I have the same problem.
Author
Owner

@beberlei commented on GitHub (Mar 27, 2020):

Fixed by #37

@beberlei commented on GitHub (Mar 27, 2020): Fixed by #37
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/reflection#9