Skip to content

Conversation

hariombalhara
Copy link
Member

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+) with strpos() !== false for 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

  • Test on PHP 5.6-7.4 - Install and activate plugin on older PHP versions where str_contains() doesn't exist (this was the original failure case)
  • Test actual Cal.com embeds - Verify shortcodes work with real Cal.com booking URLs: [cal url="/username/meeting"]
  • Test both embed modes - Verify inline (type="1") and popup (type="2") embeds render correctly
  • Install on WordPress 6.8.2 - Confirm plugin installs and activates without errors on latest WordPress
  • Verify logic equivalence - Double-check that strpos($string, $needle) !== false behaves identically to str_contains($string, $needle) in all edge cases

Recommended 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:#FFFFFF
Loading

Notes

  • Critical Fix: The str_contains() function was introduced in PHP 8.0, but plugin claimed PHP 5.2.4+ support
  • Testing Performed: Verified plugin loads without fatal errors on PHP 8.1 and shortcode generates expected HTML
  • Not Tested: Actual Cal.com embed functionality with live booking URLs - requires human verification
  • Session Details: Requested by @hariombalhara, session: https://app.devin.ai/sessions/9de988b874ca446c9c1d5417152d51a6

Test Results

…ments

- Replace str_contains() with strpos() !== false for PHP 5.6+ compatibility
- Update WordPress tested version from 6.0.1 to 6.8.2
- Update PHP requirement from 5.2.4 to 5.6 for realistic compatibility
- Fixes fatal errors on older PHP versions that many WordPress sites use

Co-Authored-By: [email protected] <[email protected]>
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.

1 participant