Fix dynamic property deprecation for display_options#92
Merged
Conversation
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.
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #87.
On PHP 8.2 and later, rendering a page that uses
#compound_queryraises:CompoundQueryProcessor::getQueryResultFromQueryString()attached adisplay_optionsarray to every SMW result data item. Writing an undeclared property onSMW\DataItems\WikiPageis what triggers the notice.Why removing it is correct
display_optionsis a leftover from old SMW, where result printers read display options off wiki-page values. In current Semantic MediaWiki nothing reads it:display_optionsanywhere in Semantic MediaWiki — no result printer,ResultArray, or data value consumes it.CompoundQueryResult::addResult(), which has no callers (and read the property off theQueryResultrather than the data item anyway).queryAndMergeResults()→mergeSMWQueryResults()→new CompoundQueryResult( … )— never touches 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 aformat=debugsubquery (whereStore::getQueryResult()returns a string).Changes
src/CompoundQueryProcessor.php— remove the write loop and the$parametersblock that existed only to feed it.src/CompoundQueryResult.php— remove the orphaneddisplay_optionsreader inaddResult().RELEASE-NOTES.md— note the fix under 7.0.0.Testing
php -lpasses on both changed files.display_optionsreferences remain in the codebase.composer analyze/composer testnot run locally; left to CI.🤖 Generated with Claude Code