Comments (13)
There is an updated check for non-initialized properties which causes the issue:
symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
Lines 414 to 426 in b7eb42e
Your magic __get()
method can handle uninitialized properties by returning null
. Adding this __isset()
method resolves the issue:
public function __isset(string $name): bool
{
return true;
}
from symfony.
yea that works but this is not obvious.
the docs does not say anything about this new behaviour
https://symfony.com/doc/current/components/property_access.html#magic-get-method
and its differ from the previous version.
from symfony.
i will add this here:
property-access 6.4.6 and 6.4.7 breaks doctrine migrations diff, going back to 6.4.4 fixes the issue
from symfony.
Same problem here, it break my applications
from symfony.
Looks like your class is missing the implementation of the __isset()
method:
public function __isset(string $name): bool
{
return null !== ($this->tests[$name] ?? null);
}
from symfony.
class test
{
private array $tests = [];
public function __get(string $name): mixed
{
return $this->tests[$name]?? null;
}
public function __set(string $name, mixed $value): void
{
$this->tests[$name] = $value;
}
public function __isset(string $name): bool
{
return null !== ($this->tests[$name]?? null);
}
}
$test = new test();
$propertyAccessor = new PropertyAccessor();
var_dump($propertyAccessor->getValue($test, 'Wouter'));
this does not help to fix the behaviour.
returns the same error.
from symfony.
Here is the Code
https://phpsandbox.io/n/propertyaccess-fipnm
from symfony.
Same problem here
from symfony.
Indeed, it's just a workaround.
Friendly ping @nicolas-grekas who changed the implementation in commit 9610a7c. An __isset()
implementation has been added to the TestClassMagicGet
fixture which is a BC break.
I don't see any reason why this additional check exists. IMO, it's part of the PropertyTypeExtractorInterface
to detect if the property is accessible. The ReflectionExtractor
inside the PropertyInfo
component does all the reflection logic so there should be no need to reflect the property again - even if another PropertyTypeExtractorInterface
implementation is used. Otherwise PropertyReadInfo
should be extended to return more details for the PropertyAccessor
.
from symfony.
@k0d3r1s Please open a new issue with a detailed reproducer.
from symfony.
That's because you're missing an implementation for __isset. While property access was tolerant to this, this breaks the behavior of objects with the php engine.
from symfony.
I have no problem with that, but maybe it needs some doc update
from symfony.
Maybe a note in the UPGRADE-6.4.md file? Up for a PR?
from symfony.
Related Issues (20)
- Filesystem requires symfony/process after 6.4.7./7.0.7 HOT 1
- Ignore can only be added on methods beginning with "get", "is", "has" or "set".
- [Messenger] Argument #1 ($tableName) must be of type string HOT 2
- Attempted to call an undefined method named "setCallbackWrapper" of class "Symfony\Component\Cache\Adapter\TraceableAdapter". HOT 1
- symfony/serializer version 7.0.7 now throws NotNormalizableValueException HOT 5
- [Serializer] `ObjectNormalizer` breaks when used with `PropertyInfoExtractorInterface` HOT 5
- [HttpClient] Segfault CurlResponse HOT 1
- [Translation] `translation:extract` with bundle - should also extract translations from PHP code HOT 1
- [RFC] include a new dev dependency `twig-cs-fixer` in the codebase HOT 6
- [DoctrineBridge] Possible cirtucal references of lazy-service (listener) HOT 3
- [Messenger][Doctrine] cleanup only the configured queue_name
- BicValidator/IbanValidator value normalization HOT 1
- [DependencyInjection] Can not replace arguments if none have been configured yet - InlineAutowire HOT 3
- [Routing] Output IDN domains instead of punycode for `UrlGeneratorInterface::ABSOLUTE_URL`
- [FrameworkBundle] KernelTestCase does not respect test env
- [Ldap] UpdateOperation toArray() function throws exception when using LDAP_MODIFY_BATCH_REMOVE_ALL operation type HOT 4
- [Messenger][AMQP] Allow to opt out to autosetup delay exchange in configuration HOT 1
- [Validator] Class "Locale" not found HOT 1
- The configuration of packages in the application is ignored after they are applied inside `prependExtension` the bundle HOT 4
- [symfony/yaml] Yaml::dump cannot properly parse array of arrays / nested arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfony.