[Symfony 7.3-RC1] The "Symfony\Component\VarExporter\LazyGhostTrait" trait is deprecated, use native lazy objects instead. #7511

Closed
opened 2026-01-22 15:52:36 +01:00 by admin · 19 comments
Owner

Originally created by @ruudk on GitHub (May 27, 2025).

Note

I searched this repository and the DoctrineBundle but couldn't find it. But I have the feeling this is already taken care of, but not yet released. Posting it anyway, so that others can find this problem too and hopefully see the answer below.

Today I tried installing Symfony 7.3 RC1 and the following deprecation appeared in my tests:

1) vendor/symfony/var-exporter/LazyGhostTrait.php:21
Since symfony/var-exporter 7.3: The "Symfony\Component\VarExporter\LazyGhostTrait" trait is deprecated, use native lazy objects instead.

Is there a workaround for this?

Originally created by @ruudk on GitHub (May 27, 2025). > [!NOTE] > I searched this repository and the DoctrineBundle but couldn't find it. But I have the feeling this is already taken care of, but not yet released. Posting it anyway, so that others can find this problem too and hopefully see the answer below. Today I tried installing Symfony 7.3 RC1 and the following deprecation appeared in my tests: ``` 1) vendor/symfony/var-exporter/LazyGhostTrait.php:21 Since symfony/var-exporter 7.3: The "Symfony\Component\VarExporter\LazyGhostTrait" trait is deprecated, use native lazy objects instead. ``` Is there a workaround for this?
admin closed this issue 2026-01-22 15:52:36 +01:00
Author
Owner

@mbabker commented on GitHub (May 27, 2025):

Use PHP 8.4 + ORM 3.4 when released + config changes from https://github.com/doctrine/orm/pull/11853

@mbabker commented on GitHub (May 27, 2025): Use PHP 8.4 + ORM 3.4 when released + config changes from https://github.com/doctrine/orm/pull/11853
Author
Owner

@ruudk commented on GitHub (May 27, 2025):

@mbabker thanks! Is there an ETA for 3.4?

@ruudk commented on GitHub (May 27, 2025): @mbabker thanks! Is there an ETA for 3.4?
Author
Owner

@derrabus commented on GitHub (May 27, 2025):

We'll try to make it happen soon'ish. ✌️

@derrabus commented on GitHub (May 27, 2025): We'll try to make it happen soon'ish. ✌️
Author
Owner

@OrestisZag commented on GitHub (Jun 13, 2025):

@derrabus I am pretty sure you are working on this very hard, but is there any update about when the 3.4 will be released? 😃

@OrestisZag commented on GitHub (Jun 13, 2025): @derrabus I am pretty sure you are working on this very hard, but is there any update about when the 3.4 will be released? 😃
Author
Owner

@greg0ire commented on GitHub (Jun 13, 2025):

We have discussed it internally and found a PR that we might want to ship with 3.4.0, and that needs a review.

@greg0ire commented on GitHub (Jun 13, 2025): We have discussed it internally and found a PR that we might want to ship with 3.4.0, and that needs a review.
Author
Owner

@ruudk commented on GitHub (Jun 14, 2025):

@greg0ire which PR is that? Could you assign it to the milestone so that it's visible?

@ruudk commented on GitHub (Jun 14, 2025): @greg0ire which PR is that? Could you assign it to the milestone so that it's visible?
Author
Owner

@beberlei commented on GitHub (Jun 14, 2025):

3.4 is out now

@beberlei commented on GitHub (Jun 14, 2025): 3.4 is out now
Author
Owner

@eltharin commented on GitHub (Jun 14, 2025):

Message still always present, comme from the trait_exists function call in DI\DoctrineExtension.php (had the same issue on maker bundle).

Is it preferable to move deprecation in a class function (but witch one ? ) in a symfony PR or test another file in DI in doctrine ?

@eltharin commented on GitHub (Jun 14, 2025): Message still always present, comme from the `trait_exists` function call in DI\DoctrineExtension.php (had the same issue on maker bundle). Is it preferable to move deprecation in a class function (but witch one ? ) in a symfony PR or test another file in DI in doctrine ?
Author
Owner

@greg0ire commented on GitHub (Jun 14, 2025):

Message still always present, comme from the trait_exists function call in DI\DoctrineExtension.php (had the same issue on maker bundle).

Please provide a link.

@greg0ire commented on GitHub (Jun 14, 2025): > Message still always present, comme from the trait_exists function call in DI\DoctrineExtension.php (had the same issue on maker bundle). Please provide a link.
Author
Owner

@eltharin commented on GitHub (Jun 14, 2025):

Oh... already change https://github.com/doctrine/DoctrineBundle/blob/2.14.x/src/DependencyInjection/DoctrineExtension.php#L560
was if (! trait_exists(LazyGhostTrait::class)) { before

Fixed in bd90d28f9e

sorry

@eltharin commented on GitHub (Jun 14, 2025): Oh... already change https://github.com/doctrine/DoctrineBundle/blob/2.14.x/src/DependencyInjection/DoctrineExtension.php#L560 was `if (! trait_exists(LazyGhostTrait::class)) {` before Fixed in https://github.com/doctrine/DoctrineBundle/commit/bd90d28f9e78088a3a38b5e8a40580eb91f4b036 sorry
Author
Owner

@michaljusiega commented on GitHub (Jun 14, 2025):

@greg0ire It's is possible to support new configuration option enableNativeLazyObjects from https://github.com/doctrine/orm/pull/11853 in https://github.com/doctrine/DoctrineBundle ?

Anyway, thanks for 3.4.0 release guys! Good job!

@michaljusiega commented on GitHub (Jun 14, 2025): @greg0ire It's is possible to support new configuration option `enableNativeLazyObjects` from https://github.com/doctrine/orm/pull/11853 in https://github.com/doctrine/DoctrineBundle ? Anyway, thanks for 3.4.0 release guys! Good job!
Author
Owner

@ruudk commented on GitHub (Jun 14, 2025):

Oh... already change https://github.com/doctrine/DoctrineBundle/blob/2.14.x/src/DependencyInjection/DoctrineExtension.php#L560
was if (! trait_exists(LazyGhostTrait::class)) { before

Fixed in bd90d28f9e

Does it mean we need a newly tagged release of DoctrineBundle then?

@ruudk commented on GitHub (Jun 14, 2025): > Oh... already change https://github.com/doctrine/DoctrineBundle/blob/2.14.x/src/DependencyInjection/DoctrineExtension.php#L560 > was `if (! trait_exists(LazyGhostTrait::class)) {` before > > Fixed in https://github.com/doctrine/DoctrineBundle/commit/bd90d28f9e78088a3a38b5e8a40580eb91f4b036 Does it mean we need a newly tagged release of DoctrineBundle then?
Author
Owner

@eltharin commented on GitHub (Jun 14, 2025):

It seems yes. (I try dev files and have no deprecation)

@eltharin commented on GitHub (Jun 14, 2025): It seems yes. (I try dev files and have no deprecation)
Author
Owner

@ruudk commented on GitHub (Jun 14, 2025):

@greg0ire @beberlei would you be able to help with a release of the bundle too? Then we can close this as resolved. Thanks for all the hard work 🙌🙌

@ruudk commented on GitHub (Jun 14, 2025): @greg0ire @beberlei would you be able to help with a release of the bundle too? Then we can close this as resolved. Thanks for all the hard work 🙌🙌
Author
Owner

@greg0ire commented on GitHub (Jun 15, 2025):

Sure, here you go: https://github.com/doctrine/DoctrineBundle/releases/tag/2.14.1

Cc @ostrolucky

@greg0ire commented on GitHub (Jun 15, 2025): Sure, here you go: https://github.com/doctrine/DoctrineBundle/releases/tag/2.14.1 Cc @ostrolucky
Author
Owner

@ruudk commented on GitHub (Jun 15, 2025):

@greg0ire I think the fix was merged into 2.15.x bd90d28f9e

Whoops, never mind!

@ruudk commented on GitHub (Jun 15, 2025): @greg0ire I think the fix was merged into 2.15.x https://github.com/doctrine/DoctrineBundle/commit/bd90d28f9e78088a3a38b5e8a40580eb91f4b036 Whoops, never mind!
Author
Owner

@greg0ire commented on GitHub (Jun 15, 2025):

Yes the history is a bit weird, I think it was committed directly to the branch without a PR, and then since the wrong branch was picked for https://github.com/doctrine/DoctrineBundle/pull/1887, it got merged up in that PR accidentally.

@greg0ire commented on GitHub (Jun 15, 2025): Yes the history is a bit weird, I think it was committed directly to the branch without a PR, and then since the wrong branch was picked for https://github.com/doctrine/DoctrineBundle/pull/1887, it got merged up in that PR accidentally.
Author
Owner

@greg0ire commented on GitHub (Jun 15, 2025):

@greg0ire It's is possible to support new configuration option enableNativeLazyObjects from https://github.com/doctrine/orm/pull/11853 in https://github.com/doctrine/DoctrineBundle ?

@michaljusiega I don't think there should be any blocker

@greg0ire commented on GitHub (Jun 15, 2025): > @greg0ire It's is possible to support new configuration option enableNativeLazyObjects from https://github.com/doctrine/orm/pull/11853 in https://github.com/doctrine/DoctrineBundle ? @michaljusiega I don't think there should be any blocker
Author
Owner

@eltharin commented on GitHub (Jun 15, 2025):

if any blocker, I made that : https://github.com/doctrine/DoctrineBundle/pull/1888

@eltharin commented on GitHub (Jun 15, 2025): if any blocker, I made that : https://github.com/doctrine/DoctrineBundle/pull/1888
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7511