Skip to content

Fix: PHP 8.2+ dynamic property deprecations in WPUM_Field#435

Merged
polevaultweb merged 3 commits intodevelopfrom
fix/wpum-field-dynamic-properties
Mar 14, 2026
Merged

Fix: PHP 8.2+ dynamic property deprecations in WPUM_Field#435
polevaultweb merged 3 commits intodevelopfrom
fix/wpum-field-dynamic-properties

Conversation

@polevaultweb
Copy link
Contributor

Fixes #434

Problem

Sites upgraded from older WPUM versions may still have legacy columns in their wpum_fields table (is_required, show_on_registration, can_delete, default_visibility, allow_custom_visibility, options, meta) left over from before field configuration was migrated to wpum_fieldmeta. dbDelta() never drops columns, so they persist indefinitely.

WPUM_DB::get() uses SELECT *, which returns all columns including these orphaned ones. setup_field() then assigned every returned property directly to $this, creating dynamic properties that PHP 8.2+ deprecates.

Fix

Filter the loop in setup_field() to only assign columns that are part of the declared schema (get_columns()). Orphaned legacy columns are silently ignored — no database migration needed.

Testing

On a site with legacy wpum_fields columns, the deprecation notices at class-wpum-field.php:214 should no longer appear on PHP 8.2+.

@polevaultweb polevaultweb merged commit eb3c72e into develop Mar 14, 2026
19 checks passed
@polevaultweb polevaultweb deleted the fix/wpum-field-dynamic-properties branch March 14, 2026 11:31
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.

Fix: PHP 8.2+ dynamic property deprecations from legacy wpum_fields columns

1 participant