Fix WordPress 6.8.2 compatibility and PHP 8.0+ compatibility issues #15
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.
Fix WordPress 6.8.2 compatibility and PHP 8.0+ compatibility issues
Summary
This PR resolves critical compatibility issues preventing the Cal.com WordPress plugin from working with modern WordPress installations:
Primary Fix: Replaced
str_contains()function (PHP 8.0+) withstrpos() !== falsefor backward compatibility. The plugin was claiming PHP 5.2.4+ support but using PHP 8.0+ functions, causing fatal errors on many WordPress sites still running older PHP versions.Version Updates: Updated WordPress compatibility from 6.0.1 to 6.8.2 (latest) and PHP requirement from unrealistic 5.2.4 to more practical 5.6.
Review & Testing Checklist for Human
str_contains()doesn't exist (this was the original failure case)[cal url="/username/meeting"]type="1") and popup (type="2") embeds render correctlystrpos($string, $needle) !== falsebehaves identically tostr_contains($string, $needle)in all edge casesRecommended Test Plan: Set up WordPress on PHP 7.4, install plugin, create test page with
[cal url="/test/30min" type="1"]and[cal url="/test/30min" type="2" text="Book Now"]shortcodes, verify both render without PHP errors.Diagram
%%{ init : { "theme" : "default" }}%% graph TD A["cal.com.php<br/>(Main Plugin File)"]:::context B["inc/class.embed.php<br/>(Shortcode Handler)"]:::major-edit C["readme.txt<br/>(Plugin Metadata)"]:::minor-edit D["WordPress 6.8.2<br/>(Target Environment)"]:::context E["PHP 5.6-8.1<br/>(Compatibility Range)"]:::context A -->|includes| B B -->|str_contains to strpos fix| E C -->|updated requirements| D C -->|updated requirements| E subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
str_contains()function was introduced in PHP 8.0, but plugin claimed PHP 5.2.4+ support