Skip to content

Fix fatal error on WordPress older than 5.9 with PHP 7.4 - #1563

Open
y000yal wants to merge 1 commit into
developfrom
fix/1963-php74-older-wordpress-crash
Open

y000yal wants to merge 1 commit into
developfrom
fix/1963-php74-older-wordpress-crash

Conversation

@y000yal

@y000yal y000yal commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

On WordPress older than 5.9 with PHP 7.4, two spots could stop the site with a fatal error: saving some settings, and adding a membership field in the form builder. They now use a check that works on every supported version. Nothing changes for users on newer setups.

Part of themegrill/user-registration-pro#1963.

How to test the changes in this Pull Request:

  1. On WordPress 5.8 with PHP 7.4, open a registration form in the builder and add a Membership field. It should add without an error.
  2. Save the plugin settings. They should save without an error.
  3. Repeat on the latest WordPress and PHP. Same result as before.

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (modification of the currently available functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully ran tests with your changes locally?
  • Have you updated the documentation accordingly?

Changelog entry

Fix - Fatal error on WordPress older than 5.9 with PHP 7.4.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@y000yal y000yal added bug compatibility Support code for another PR labels Oct 27, 2026
@y000yal y000yal self-assigned this Oct 27, 2026
@y000yal
y000yal requested a review from bhattaganesh October 27, 2026 06:45
@tg-autopilot
tg-autopilot requested a lite review from Copilot October 27, 2026 06:45
@github-actions

Copy link
Copy Markdown

QA suite — refused, no regression spec

This PR changes product source but adds no spec, so the suite was
refused before booting WordPress — running it just to report the same
thing at the end costs runner minutes for nothing. Run
/claudegrill:verify-fix locally and let write-spec add the guard
to this branch, then push again.

Source files changed with no matching spec
includes/functions-ur-core.php
modules/membership/includes/Admin/Forms/class-ur-form-field-membership.php

@tg-autopilot

Copy link
Copy Markdown
Contributor

Build for d3bf8f97 is ready 🛎️

⬇️ Download user-registration-5.3.1.zip (8.2M)

🚀 Try this PR in a live test site (a fresh WordPress opens in your browser with this build installed and you logged in as admin; it resets when you close the tab)

Installs directly via Plugins → Add New → Upload Plugin.
Link expires in 30 days · updated Oct 27, 2026 12:32 PM +0545

A later push only rebuilds this if its commit message includes #build-zip.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The compatibility fixes are targeted, preserve existing behavior, and have no unresolved review issues.

No open issues 🎉

What changed in this PR

Fixes PHP 7.4 compatibility issues on older WordPress versions by replacing PHP 8-only str_contains() calls in membership field creation and settings parsing.

Changes:

  • Replaces the membership field-name check with a PHP 7.4-compatible strpos() check.
  • Replaces the settings option parsing check with a compatible strpos() check.
  • Preserves behavior on newer supported environments.
File Description
modules/​membership/​includes/​Admin/​Forms/​class-ur-form-field-membership.php Prevents fatal errors during membership field creation on PHP 7.4.
includes/​functions-ur-core.php Prevents fatal errors while parsing settings option IDs on PHP 7.4.

Review effort: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug compatibility Support code for another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants