fix(OEmbedParser): prevent TypeError when HTTP_HOST is absent or domain is null#481
Merged
Merged
Conversation
…inConfig Agent-Logs-Url: https://github.com/FriendsOfREDAXO/consent_manager/sessions/67d83af2-7c10-4ec1-8f7c-0582da0fbd18 Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TypeError for null domain argument in OEmbedParser
fix(OEmbedParser): prevent TypeError when HTTP_HOST is absent or domain is null
Apr 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a sporadic PHP 8 TypeError in the Consent Manager’s CKE5 oEmbed integration by ensuring domain resolution and domain-config loading remain safe when HTTP_HOST and/or rex::getServer() are unavailable (or evaluate to null), falling back to default config instead of crashing.
Changes:
- Ensure
parse()never passesnullas a domain by using an explicit''fallback forrex_request::server('HTTP_HOST', ...). - Ensure
processOembed()can’t propagatenullinto domain config lookup by adding a final?? ''fallback. - Make
getDomainConfig()accept?stringand early-return the default config when the domain isnull/empty.
- Rexstan-konforme Null- und Return-Guards in OEmbedParser - Version auf 5.6.5 angehoben - Changelog fuer PR-Änderungen ergänzt
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.
Sporadic
TypeErrorinOEmbedParser::getDomainConfig()whenHTTP_HOSTis unavailable (e.g. proxy/CLI edge cases or alternative host setups).Root cause
parse()andprocessOembed()could pass a nullable domain into domain-config resolution. In PHP 8 this can break on strict type expectations and in practice led to unstable behavior for edge deployments.Changes
parse()with REDAXO-aware fallback viarex_request::server(..., rex::getServer()).parse()sopreg_replace_callback()can never leak a null return.getDomainConfig()defensively nullable and return default config for empty/null domain.processOembed()and removed redundant null-coalesce paths.class_exists/method_exists) to avoid addon-coupling issues when Vidstack is missing or incompatible.Quality / Best Practices
lib/OEmbedParser.php: 0 errors.package.yml.CHANGELOG.md.