Repository navigation
Fix PHP 8.5 compatibility and harden input sanitization - #20
Merged
Merged
Conversation
rhoerr
reviewed
Apr 30, 2026
Member
|
@dadolun95 Can you review this, when time allows? |
marcelmtz
previously requested changes
Apr 30, 2026
PHP 8.3+ feature, but composer.json declares 8.1+ support. Reorder LocalizedException import alphabetically while here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rhoerr
approved these changes
May 15, 2026
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
This PR makes the module fully compatible with PHP 8.5 while preserving PHP 8.1-8.4 support. Changes focus on:
preg_replace_callback/preg_replaceagainstnullsubjects (PHP 8.5 emits deprecation notices on implicit null subjects).Build::sanitizeWidgetParamsso all string-sanitization paths go through a singlesanitizeStringValue()helper that tolerates non-string input arriving from the request.Build::isTypeValidto accept mixed input from the POST payload and validate defensively instead of relying on a strictstringtype hint.getCacheKey(): string/getCacheKeyInfo(): arrayreturn types onBlock\Adminhtml\Widget\Preview\NewWidgetto match the parent contract (same fix already applied toProductsListin 1.4.1).HTML_ID_PLACEHOLDER,SCRIPT_REPLACE_REGEX) and consolidatinguseimports.composer.json:~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0.Files touched
composer.jsonCHANGELOG.mdBlock/Adminhtml/Widget/Preview/NewWidget.phpBlock/Adminhtml/Widget/Preview/ProductsList.phpComponent/Form/WidgetData.phpController/Adminhtml/ContentType/Widget/Build.phpModel/Config/Converter.phpPlugin/WidgetContentSettingsCleanup.phpTest plan
php -lpasses on PHP 8.4 for every changed file (local sanity check).Suggested release
Once merged, I would suggest tagging
1.5.0(minor bump because the composer.json PHP constraint is broadened and a CHANGELOG entry is added).cc @rhoerr - opening this against
masteras a follow-up to the 8.4 PR that already shipped in 1.4.x.