Skip to content

Fix dynamic property deprecation for display_options#92

Merged
alistair3149 merged 1 commit into
masterfrom
fix-display-options-dynamic-property
Jun 2, 2026
Merged

Fix dynamic property deprecation for display_options#92
alistair3149 merged 1 commit into
masterfrom
fix-display-options-dynamic-property

Conversation

@alistair3149

Copy link
Copy Markdown
Member

Summary

Fixes #87.

On PHP 8.2 and later, rendering a page that uses #compound_query raises:

Deprecated: Creation of dynamic property SMW\DataItems\WikiPage::$display_options is deprecated in src/CompoundQueryProcessor.php

CompoundQueryProcessor::getQueryResultFromQueryString() attached a display_options array to every SMW result data item. Writing an undeclared property on SMW\DataItems\WikiPage is what triggers the notice.

Why removing it is correct

display_options is a leftover from old SMW, where result printers read display options off wiki-page values. In current Semantic MediaWiki nothing reads it:

  • There is no reference to display_options anywhere in Semantic MediaWiki — no result printer, ResultArray, or data value consumes it.
  • Its only reader in this extension was CompoundQueryResult::addResult(), which has no callers (and read the property off the QueryResult rather than the data item anyway).
  • The merge path that actually runs — queryAndMergeResults()mergeSMWQueryResults()new CompoundQueryResult( … ) — never touches it.
  • No test depends on it.

Because nothing consumes the property, removing it produces identical rendered output. It also removes a latent fatal: the old code called $queryResult->getResults() unconditionally, which would error on a format=debug subquery (where Store::getQueryResult() returns a string).

Changes

  • src/CompoundQueryProcessor.php — remove the write loop and the $parameters block that existed only to feed it.
  • src/CompoundQueryResult.php — remove the orphaned display_options reader in addResult().
  • RELEASE-NOTES.md — note the fix under 7.0.0.

Testing

  • php -l passes on both changed files.
  • Confirmed no display_options references remain in the codebase.
  • Full composer analyze / composer test not run locally; left to CI.

🤖 Generated with Claude Code

CompoundQueryProcessor attached a display_options array to every SMW
result data item. On PHP 8.2+ this undeclared-property write raises a
"Creation of dynamic property SMW\DataItems\WikiPage::$display_options
is deprecated" notice (#87).

The property is a leftover from old SMW; nothing in current Semantic
MediaWiki or this extension reads it. Its only reader was
CompoundQueryResult::addResult(), which has no callers, and the live
merge path (queryAndMergeResults -> mergeSMWQueryResults -> new
CompoundQueryResult) never touched it. Removing the producer and the
orphaned reader clears the deprecation without changing rendered output.
@alistair3149 alistair3149 marked this pull request as ready for review June 2, 2026 22:53
@alistair3149 alistair3149 merged commit 33cc6fb into master Jun 2, 2026
5 checks passed
@alistair3149 alistair3149 deleted the fix-display-options-dynamic-property branch June 2, 2026 22:53
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 28.57%. Comparing base (e67cd74) to head (9f7a955).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/CompoundQueryProcessor.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #92      +/-   ##
============================================
+ Coverage     26.35%   28.57%   +2.21%     
+ Complexity       48       44       -4     
============================================
  Files             3        3              
  Lines           129      119      -10     
============================================
  Hits             34       34              
+ Misses           95       85      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecated: Creation of dynamic property

1 participant