We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6.3.1
I got an exception when I try to access a "static" properties.
Typed property App\Lazy\Lazy::$a must not be accessed before initialization
With this code
<?php namespace App\Lazy; class Lazy { private int $a; public function __construct( private readonly Deps $deps, ) { dump(__METHOD__); $this->a = 1; } public function do(): int { // $this->deps->do(); return $this->doPrivate(); } private function doPrivate(): int { return $this->a; } }
And the configuration
service: App\Lazy\Lazy: lazy: true
It throw an exception.
see this commit for a better reproducer
WARNING
It does work if I clear the cache, but If I add a new property, it does not work anymore.
So to reproduce
run the app
apply this patch (without cleanring the cache)
diff --git a/src/Lazy/Lazy.php b/src/Lazy/Lazy.php index f40f60a..b2ed79c 100644 --- a/src/Lazy/Lazy.php +++ b/src/Lazy/Lazy.php @@ -5,16 +5,19 @@ namespace App\Lazy; class Lazy { private int $a; + private int $b; public function __construct( private readonly Deps $deps, ) { dump(__METHOD__); $this->a = 1; + $this->b = 1; } public function do(): int { + $this->b; // $this->deps->do(); return $this->doPrivate();
refresh the page
The text was updated successfully, but these errors were encountered:
bug #50793 [DependencyInjection] Fix resource tracking for lazy servi…
3fe8e02
…ces (nicolas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [DependencyInjection] Fix resource tracking for lazy services | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #50792 | License | MIT | Doc PR | - Commits ------- 0f737d8 [DependencyInjection] Fix resource tracking for lazy services
No branches or pull requests
Symfony version(s) affected
6.3.1
Description
I got an exception when I try to access a "static" properties.
How to reproduce
With this code
And the configuration
It throw an exception.
see this commit for a better reproducer
WARNING
It does work if I clear the cache, but If I add a new property, it does not work anymore.
So to reproduce
run the app
apply this patch (without cleanring the cache)
refresh the page
The text was updated successfully, but these errors were encountered: