⚓ T353161 [CLIENT] Creation of dynamic property MediaWiki\Title\Title::$wikibasePushedDeleteToRepo is deprecated
Page MenuHomePhabricator

[CLIENT] Creation of dynamic property MediaWiki\Title\Title::$wikibasePushedDeleteToRepo is deprecated
Closed, ResolvedPublic

Description

Seen on phpunit tests under php8.2
https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php82-noselenium-docker/130/consoleFull

PHP Deprecated: Creation of dynamic property MediaWiki\Title\Title::$wikibasePushedDeleteToRepo is deprecated in /workspace/src/includes/debug/DeprecationHelper.php on line 243

https://codesearch.wmcloud.org/search/?q=wikibasePushedDeleteToRepo&files=&excludeFiles=&repos=

Event Timeline

wikibasePushedDeleteToRepo

That reminds me of T268135 – it looks like it’s not quite the same thing (that task was about a wikibasePushedMoveToRepo dynamic property), but I suspect it’s related, and it’s possible the dynamic property can just be removed entirely. (But this needs a bit more investigation. I just saw this task and wanted to quickly leave a pointer to the other one I remembered.)

This dynamic property is causing spurious failures in phan as well, when phan randomly "gets smart enough" to notice that the Title class doesn't actually have a property named wikibasePushedDeleteToRepo. See https://integration.wikimedia.org/ci/job/mwext-php74-phan-docker/96606/console for example.

Change 998818 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] Suppress undeclared property access in `isset()`

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

Change 998818 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Suppress undeclared property access in `isset()`

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

This dynamic property is causing spurious failures in phan as well, when phan randomly "gets smart enough" to notice that the Title class doesn't actually have a property named wikibasePushedDeleteToRepo. See https://integration.wikimedia.org/ci/job/mwext-php74-phan-docker/96606/console for example.

With the remove of the DeprecationHelper trait in 7fc8d800b78e4d3d49cdadc686310485607072fe there is no Title::__set or Title::__get and phan is now strict about the undeclared properties resulting in this report (Before phan could not infer the result of set/get to report every undeclared property directly).
It should not be randomly, that mostly seen in the context of taint-check, where the order of class loading can impact the result.

ArthurTaylor renamed this task from Creation of dynamic property MediaWiki\Title\Title::$wikibasePushedDeleteToRepo is deprecated to [CLIENT] Creation of dynamic property MediaWiki\Title\Title::$wikibasePushedDeleteToRepo is deprecated.Feb 12 2024, 10:02 AM
ArthurTaylor moved this task from Incoming to [DOT] By Project on the wmde-wikidata-tech board.

Would it be possible to expedite this fix, please? It's blocking CI (and the MediaWiki support for) PHP 8.2 generally.

Prio Notes:

Impact AreaAffectedNotes
production / end usersNot until production moves to PHP 8.2, which will take quite some time (the next target after mw-on-k8s is 8.1)
monitoring
development effortsDynamic properties are confusing; developers on PHP 8.2 have to disable deprecation warnings
onboarding efforts
additional stakeholdersStrongly affected – blocks PHP 8.2 on several extensions, including ones by other teams (e.g. GrowthExperiments)

Not until production moves to PHP 8.2, which will take quite some time (the next target after mw-on-k8s is 8.1)

I don't believe this is true; my understanding is that we plan to move to 8.1 and then immediately to 8.3.

The situation looks indeed fairly similar to T268135 (I recommend reading that task description first):

  • We have again two hook handlers communicating with one another through the dynamic property; UpdateRepoHookHandler::onArticleDeleteComplete() records whether the job queue insertion was successful, and DeletePageNoticeCreator::getMessage() determines whether “We're going to update the item using the repo job queue \o/” or “The user has to update the item per hand for some reason” (quoting from the code comments) and shows the appropriate message.
  • The two hooks (ArticleDeleteComplete and ArticleDeleteAfterSuccess) still run in the order Wikibase expects (unlike the other task, they weren’t swapped around); but at some point, they started pointing to different Title instances. The Title seen by the first hook has its mArticleId, mLatestId, mContentModel and mLength initialized; in the Title seen by the second hook, they’re uninitialized. This might have been introduced by Clone WikiPage before delete in August 2016, but I’m not sure.
  • The wikibase-after-page-delete message was also changed (in 2017) from “You should also remove the link…” to “Link … should have been removed … we ask that you check this has occurred”.
  • (There’s nothing corresponding to the fourth bullet point.)

So, again, the “successful” version of the message (wikibase-after-page-delete-queued) has been unreachable for many years. As in T268135, I don’t think we need to bother resurrecting this communication between the two hook handlers to a working state – let’s just use the other message (wikibase-after-page-delete), which was already rephrased to cover both possible situations.

Change #1017310 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Drop wikibase-after-page-delete-queued message

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

Change #1017310 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Drop wikibase-after-page-delete-queued message

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

Change #1023151 had a related patch set uploaded (by Jforrester; author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@REL1_42] Drop wikibase-after-page-delete-queued message

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

Change #1023401 had a related patch set uploaded (by Jforrester; author: Jforrester):

[integration/config@master] Zuul: Re-apply PHP 8.2 CI to Wikibase-based code

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

Change #1023151 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@REL1_42] Drop wikibase-after-page-delete-queued message

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

Change #1023401 merged by jenkins-bot:

[integration/config@master] Zuul: Re-apply PHP 8.2 CI to Wikibase-based code

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