Page MenuHomePhabricator

PHP 8.2: Dynamic property creation is deprecated
Open, Needs TriagePublic

Description

Per https://github.com/php/php-src/blob/107ad28350e76f40d6e65ceac4e45cbf8cc3dc75/UPGRADING#L138:

. Creation of dynamic properties is deprecated, unless the class opts in by
  using the #[AllowDynamicProperties] attribute. stdClass allows dynamic
  properties. Usage of __get()/__set() is not affected by this change. A
  dynamic properties deprecation warning can be addressed by:
   - Declaring the property (preferred).
   - Adding the #[AllowDynamicProperties] attribute to the class (which also
     applies to all child classes).
   - Using a WeakMap if you wish to associate additional data with an object
     you do not own.

Out of the three suggested migration paths, the third one (WeakMap) is not really an option as of now given that WeakMaps were added in PHP 8.

Details

SubjectRepoBranchLines +/-
mediawiki/extensions/MathREL1_40+7 -2
mediawiki/extensions/MathREL1_41+7 -2
mediawiki/extensions/MathREL1_39+9 K -0
mediawiki/extensions/Mathmaster+7 -2
mediawiki/services/parsoidREL1_39+1 -0
mediawiki/services/parsoidREL1_41+10 -3
mediawiki/services/parsoidmaster+10 -3
mediawiki/vendormaster+206 -96
mediawiki/services/parsoidREL1_40+10 -3
mediawiki/services/parsoidREL1_39+10 -3
mediawiki/extensions/Wikibasemaster+28 -3
mediawiki/extensions/WikibaseLexememaster+10 -0
mediawiki/extensions/WikibaseMediaInfomaster+5 -0
mediawiki/vendormaster+663 -180
mediawiki/services/parsoidmaster+1 -0
mediawiki/coremaster+3 -1
mediawiki/coreREL1_38+4 -4
mediawiki/coreREL1_35+4 -4
mediawiki/coreREL1_39+4 -4
mediawiki/coremaster+4 -4
mediawiki/coreREL1_39+51 -15
mediawiki/coremaster+51 -15
mediawiki/coreREL1_39+6 -10
mediawiki/vendormaster+288 -112
mediawiki/coremaster+6 -10
mediawiki/coreREL1_39+1 -1
mediawiki/coremaster+1 -1
mediawiki/coreREL1_39+0 -3
mediawiki/coreREL1_39+6 -0
mediawiki/coremaster+0 -3
mediawiki/coremaster+6 -0
mediawiki/coreREL1_39+1 -0
mediawiki/coremaster+1 -0
mediawiki/coreREL1_39+3 -0
mediawiki/coremaster+3 -0
mediawiki/coreREL1_39+1 -4
mediawiki/coremaster+1 -4
mediawiki/services/parsoidmaster+9 -0
mediawiki/services/parsoidREL1_39+9 -0
mediawiki/coreREL1_39+1 -4
mediawiki/coremaster+1 -4
mediawiki/coreREL1_39+0 -2
mediawiki/coremaster+0 -2
mediawiki/coreREL1_38+5 -1
mediawiki/coreREL1_35+5 -0
mediawiki/coreREL1_37+5 -1
mediawiki/coreREL1_35+1 -0
mediawiki/coreREL1_37+1 -0
mediawiki/coreREL1_38+1 -0
mediawiki/coremaster+1 -0
mediawiki/coreREL1_35+21 -2
mediawiki/coreREL1_37+20 -5
mediawiki/coreREL1_38+20 -5
mediawiki/coremaster+8 -4
mediawiki/coremaster+20 -5
Show related patches Customize query in gerrit

Related Objects

StatusSubtypeAssignedTask
OpenNone
ResolvedReedy
ResolvedReedy
DuplicateNone
ResolvedTK-999
ResolvedReedy
ResolvedUmherirrender
ResolvedUmherirrender
OpenNone
ResolvedReedy
ResolvedReedy
ResolvedNone
ResolvedReedy
ResolvedTK-999
ResolvedUmherirrender
ResolvedAmmarpad
ResolvedTgr
ResolvedPleaseStand
ResolvedNone
Resolved brooke
ResolvedNone
ResolvedUmherirrender
OpenNone
ResolvedReedy
ResolvedBUG REPORTAManWithNoPlan
OpenNone

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 876307 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] tests: Handle dynamic created properties on test classes

https://gerrit.wikimedia.org/r/876307

Change 876315 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/services/parsoid@master] Add AllowDynamicProperties to Wikimedia\Parsoid\DOM\Document

https://gerrit.wikimedia.org/r/876315

Change 876320 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/876320

Change 876321 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] tests: Replace dynamic property MWCallableUpdate::$_name

https://gerrit.wikimedia.org/r/876321

Change 876321 merged by jenkins-bot:

[mediawiki/core@master] tests: Replace dynamic property MWCallableUpdate::$_name

https://gerrit.wikimedia.org/r/876321

Change 877145 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@REL1_39] tests: Replace dynamic property MWCallableUpdate::$_name

https://gerrit.wikimedia.org/r/877145

Change 877256 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a10

https://gerrit.wikimedia.org/r/877256

Change 877256 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a10

https://gerrit.wikimedia.org/r/877256

The lib wikimedia/less.php has also some dynamic properties, which are fixed with https://github.com/wikimedia/less.php/commit/a93b0827b650a347f7c694e1e234f8c86efa8812, no new release yet.

v3.2.0 is out - https://gerrit.wikimedia.org/r/877264 and https://gerrit.wikimedia.org/r/877266 to get that into master

Change 877145 merged by jenkins-bot:

[mediawiki/core@REL1_39] tests: Replace dynamic property MWCallableUpdate::$_name

https://gerrit.wikimedia.org/r/877145

Noticed in T324898: Deprecated: Creation of dynamic property in OAuth that phan's PhanUndeclaredProperty can pick this up, if it's not suppressed...

Definitely various inline suppressions, which is probably another good way to hunt for usages that potentially need addressing - https://codesearch.wmcloud.org/search/?q=PhanUndeclaredProperty&i=nope&files=&excludeFiles=&repos=

Noticed in T324898: Deprecated: Creation of dynamic property in OAuth that phan's PhanUndeclaredProperty can pick this up, if it's not suppressed...

Definitely various inline suppressions, which is probably another good way to hunt for usages that potentially need addressing - https://codesearch.wmcloud.org/search/?q=PhanUndeclaredProperty&i=nope&files=&excludeFiles=&repos=

Not in tests, phan runs only for production code. And not for classes implements __get/__set (directly or with trait), that makes it also harder for static analyzer to see correct or incorrect usages (T326479 for example was not picked up by phan, while it shows up when there is no get/set in Status)

Noticed in T324898: Deprecated: Creation of dynamic property in OAuth that phan's PhanUndeclaredProperty can pick this up, if it's not suppressed...

Definitely various inline suppressions, which is probably another good way to hunt for usages that potentially need addressing - https://codesearch.wmcloud.org/search/?q=PhanUndeclaredProperty&i=nope&files=&excludeFiles=&repos=

Not in tests, phan runs only for production code. And not for classes implements __get/__set (directly or with trait), that makes it also harder for static analyzer to see correct or incorrect usages (T326479 for example was not picked up by phan, while it shows up when there is no get/set in Status)

Well, sure... But it's a reference to find some of them, rather than waiting for code execution to hit them later :)

Change 876307 merged by jenkins-bot:

[mediawiki/core@master] tests: Handle dynamic created properties on test classes

https://gerrit.wikimedia.org/r/876307

Change 879794 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@REL1_39] tests: Handle dynamic created properties on test classes

https://gerrit.wikimedia.org/r/879794

Change 879794 merged by jenkins-bot:

[mediawiki/core@REL1_39] tests: Handle dynamic created properties on test classes

https://gerrit.wikimedia.org/r/879794

Change 876320 merged by jenkins-bot:

[mediawiki/core@master] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/876320

Change 886413 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@REL1_39] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886413

Umherirrender reopened this task as Open.
Umherirrender claimed this task.
Umherirrender removed Umherirrender as the assignee of this task.

[Assumed this was a specific sub task for the Status::$itemStatuses issue ..., reopened]

Change 886414 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/core@REL1_38] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886414

Change 886415 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/core@REL1_35] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886415

Change 886413 merged by jenkins-bot:

[mediawiki/core@REL1_39] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886413

Change 886415 merged by jenkins-bot:

[mediawiki/core@REL1_35] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886415

Change 886414 merged by jenkins-bot:

[mediawiki/core@REL1_38] revisiondelete: Replace dynamic property Status::$itemStatuses

https://gerrit.wikimedia.org/r/886414

Change 876281 abandoned by Umherirrender:

[mediawiki/core@master] tests: Suppress dynamic properties on PHP 8.2 for SerializationTestUtils

Reason:

Needs another approach

https://gerrit.wikimedia.org/r/876281

Change 876315 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Add AllowDynamicProperties to Wikimedia\Parsoid\DOM\Document

https://gerrit.wikimedia.org/r/876315

Change 897971 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.17.0-a21

https://gerrit.wikimedia.org/r/897971

Change 897971 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.17.0-a21

https://gerrit.wikimedia.org/r/897971

Change 982092 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/services/parsoid@master] Add AllowDynamicProperties to Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/982092

Change 982123 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/WikibaseLexeme@master] tests: Declare class properties in test cases

https://gerrit.wikimedia.org/r/982123

Change 982120 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/Wikibase@master] tests: Declare class properties in test cases

https://gerrit.wikimedia.org/r/982120

Change 982126 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/WikibaseMediaInfo@master] tests: Declare class properties in MediaInfoRdfBuilderTest

https://gerrit.wikimedia.org/r/982126

Change 982126 merged by jenkins-bot:

[mediawiki/extensions/WikibaseMediaInfo@master] tests: Declare class properties in MediaInfoRdfBuilderTest

https://gerrit.wikimedia.org/r/982126

Change 982123 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] tests: Declare class properties in test cases

https://gerrit.wikimedia.org/r/982123

Change 982120 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] tests: Declare class properties in test cases

https://gerrit.wikimedia.org/r/982120

Change 982092 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/982092

Change 983902 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a9

https://gerrit.wikimedia.org/r/983902

Change 983907 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/services/parsoid@REL1_41] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983907

Change 983908 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/services/parsoid@REL1_40] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983908

Change 983909 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/services/parsoid@REL1_39] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983909

Change 983909 merged by jenkins-bot:

[mediawiki/services/parsoid@REL1_39] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983909

Change 983908 merged by jenkins-bot:

[mediawiki/services/parsoid@REL1_40] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983908

Change 983907 merged by jenkins-bot:

[mediawiki/services/parsoid@REL1_41] Set default values explicit in Wikimedia\Parsoid\Ext\Gallery\Opts

https://gerrit.wikimedia.org/r/983907

Change 983902 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a9

https://gerrit.wikimedia.org/r/983902

Change #1017468 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/services/parsoid@REL1_39] Add AllowDynamicProperties to Wikimedia\Parsoid\DOM\Document

https://gerrit.wikimedia.org/r/1017468

Change #1017468 merged by jenkins-bot:

[mediawiki/services/parsoid@REL1_39] Add AllowDynamicProperties to Wikimedia\Parsoid\DOM\Document

https://gerrit.wikimedia.org/r/1017468

Change #1017425 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/Math@master] Declare properties statically

https://gerrit.wikimedia.org/r/1017425

Change #1017425 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Declare properties statically

https://gerrit.wikimedia.org/r/1017425

Change #1017474 had a related patch set uploaded (by Reedy; author: Physikerwelt):

[mediawiki/extensions/Math@REL1_41] Declare properties statically

https://gerrit.wikimedia.org/r/1017474

Change #1017475 had a related patch set uploaded (by Reedy; author: Physikerwelt):

[mediawiki/extensions/Math@REL1_40] Declare properties statically

https://gerrit.wikimedia.org/r/1017475

Change #1017476 had a related patch set uploaded (by Reedy; author: Physikerwelt):

[mediawiki/extensions/Math@REL1_39] Declare properties statically

https://gerrit.wikimedia.org/r/1017476

Change #1017476 abandoned by Reedy:

[mediawiki/extensions/Math@REL1_39] Declare properties statically

Reason:

https://gerrit.wikimedia.org/r/1017476

Change #1017474 merged by jenkins-bot:

[mediawiki/extensions/Math@REL1_41] Declare properties statically

https://gerrit.wikimedia.org/r/1017474

Change #1017475 merged by jenkins-bot:

[mediawiki/extensions/Math@REL1_40] Declare properties statically

https://gerrit.wikimedia.org/r/1017475