- 🇺🇸United States tr Cascadia
Well again, how much of this is because of core?
Take for example
is_new
, which is a well-known and often-discussed dynamic property that is defined and used by core. In this case, Entity API is simply using core. Modifying Entity API to try to avoid PHP 8.2 errors resulting from how core usesis_new
is just the wrong thing to do - we should not be fixing every single contrib module, we should be fixing core.Has
is_new
as a dynamic property been addressed in core yet? I don't see any indication at all that core's usage ofis_new
has changed. From your "error" output, it complains 432 times aboutis_new
as a dynamic property - ALL those errors will go away when core is made compliant with PHP 8.2. NONE of those errors need to be or should be addressed in the Entity API.What needs to be done here is to identify which of the 10,000+ errors in your output are due to the Entity API, because those are the ONLY ones that should be addressed here. I would say that the vast majority of these are from core.
After core works in 8.2, THEN we can see what errors show up when adding in Entity API, and THEN we can start to address them one-by-one. And that process will be greatly enhanced by people contributing patches targeted to fix specific dynamic property errors.
- Status changed to Active
almost 2 years ago 3:44pm 22 January 2023 - 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
When I submitted this, I had mis-read which module was setting the dynamic property versus which one contained the class in question. It may be that
entity
doesn't have any classes that need to be changed.For now, I suggest enabling testing of
entity
on PHP 8.2 and the postponing if that raises no issues. There are other modules that pass testing on PHP 8.2. - 🇺🇸United States tr Cascadia
Here is the testbot output for PHP 8.2: https://www.drupal.org/pift-ci-job/2579786 →
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
Thanks.
There are a bunch of error messages like:
Creation of dynamic property Entity::$data is deprecated
Here are all the properties that are raising this error in class
Entity
:Entity::$data Entity::$id Entity::$is_new Entity::$is_rebuild Entity::$label Entity::$locked Entity::$module Entity::$name Entity::$original Entity::$rdf_mapping Entity::$status Entity::$uid Entity::$weight
Declaring these properties would fix these errors in class
Entity
. It would also be fixed by adding#[\AllowDynamicProperties]
to that class. - 🇸🇰Slovakia poker10
Has is_new as a dynamic property been addressed in core yet? I don't see any indication at all that core's usage of is_new has changed. From your "error" output, it complains 432 times about is_new as a dynamic property - ALL those errors will go away when core is made compliant with PHP 8.2. NONE of those errors need to be or should be addressed in the Entity API.
PHP 8.2 tests for core are passing. Therefore this is either not covered by tests, or it is not an issue in the core. I have not seen a report about PHP 8.2 deprecation of
is_new
in the D7 core issue queue. But I will try to verify this dynamic declaration on the D7 core side. Anyway, I agree that if something like this originates from the core, we should fix it there. - 🇸🇰Slovakia poker10
As @Liam Morland pointed out, this module defines an
Entity
class. Such class cannot declare dynamic properties in PHP 8.2. Drupal core uses stdClass for entities (such as nodes) and it is allowed to declare dynamic properties on stdClass. Therefore this seems to be related only to the entity module.See: https://php.watch/versions/8.2/dynamic-properties-deprecated#exempt
- Status changed to Needs review
over 1 year ago 9:27am 30 April 2023 - last update
over 1 year ago 47 pass - 🇸🇰Slovakia poker10
I think that at least these dynamic properties needs to be taken care of. In the
Entity
I have used#[\AllowDynamicProperties]
, elsewhere declared the missing properties. Let's check the tests if there are any more issues. - last update
over 1 year ago 46 pass, 8 fail - last update
over 1 year ago 47 pass - 🇸🇰Slovakia poker10
Missed one dynamic property
EntityMetadataIntegrationTestCase::$node
(see: https://www.drupal.org/pift-ci-job/2655384 → . Updating the patch.All other deprecations are from here: 📌 PHP 8.2 - Fix deprecated dynamic properties Fixed
- last update
over 1 year ago 47 pass - last update
over 1 year ago 47 pass - last update
over 1 year ago 47 pass, 7 fail - 🇸🇰Slovakia poker10
@TR can we please move this somehow? This is blocking usability of the module on PHP 8.2 and also Rules module. Thanks!
- Status changed to Fixed
over 1 year ago 4:18am 25 May 2023 - 🇺🇸United States tr Cascadia
Committed. Thanks. I was hoping for at least one review, because changes to the 7.x-1.x branch can affect a lot of legacy sites. But I don't think the changes in the patch have any potential to break things, so I went ahead and committed this as-is.
If you want to submit a patch for Rules, I can commit that as well.
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
Thanks. It would be helpful to update the automated testing configuration as well to add PHP 8.2.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 8:54pm 29 June 2023 - 🇨🇦Canada awasson
@TR,
The patch definitely works which is great (thanks @poker10) but is there any reason a new release hasn't been tagged? For now I'll use the Dev but it's a production site on PHP 8.2 so I'd rather use stable releases.Cheers,
Andrew - 🇨🇦Canada joseph.olstad
In addition to a tagged release with PHP 8.2 compatibility,
We also still need an updated testing configuration to add PHP 8.2 - 🇨🇦Canada joseph.olstad
@TR, we appreciate the commit, could you please also tag a PHP 8.2 compatible release and also update the testing configuration to add PHP 8.2 ?
- 🇩🇰Denmark ressa Copenhagen
The logs are getting filled with "Creation of dynamic property" warnings, and since it looks like the dev-version works well, perhaps it can get released as 8.x-1.5?