Opened 4 months ago
Last modified 3 weeks ago
#61675 reopened defect (bug)
wp-activate.php tries to set undefined property
Reported by: | skithund | Owned by: | |
---|---|---|---|
Milestone: | 6.7.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | has-patch |
Focuses: | multisite, php-compatibility | Cc: |
Description
wp-activate.php tries to set cache_enabled
property, which doesn't exist on all object cache implementations, triggering Creation of dynamic property WP_Object_Cache::$cache_enabled is deprecated
error on PHP 8.2.
<?php if ( is_object( $wp_object_cache ) ) { $wp_object_cache->cache_enabled = false; } ?>
Change History (8)
This ticket was mentioned in PR #7048 on WordPress/wordpress-develop by @skithund.
4 months ago
#1
- Keywords has-patch added
#3
@
4 months ago
- Keywords needs-patch added; has-patch removed
@skithund Thank you for reporting this. This shouldn't be possible with the WP native object cache classes as the #[AllowDynamicProperties]
attribute is set.
Having said this, as the property is explicitly used and set in WP Core, I think it would be prudent to make this property an explicitly declared one on the WP_Object_Cache
class anyhow (visibility: public
) with documentation stating that "overload" classes should declare that property.
As for existing "overload" classes, I believe patches would be needed to explicitly declare the property on those as well.
While the patch proposed protects against the deprecation notice, it does not work with magic methods in place (which the WP_Object_Cache
class has), so as things are, it would effectively disable the cache in most cases, which would break the functionality, which I don't think is your intention.
Also see: https://3v4l.org/kLAYu
This ticket was mentioned in PR #7132 on WordPress/wordpress-develop by @snehapatil02.
3 months ago
#4
- Keywords has-patch added; needs-patch removed
### Changes Made
- Added the
cache_enabled
property to theWP_Object_Cache
class.
Trac ticket: https://core.trac.wordpress.org/ticket/61675
#5
@
3 months ago
- Resolution set to invalid
- Status changed from new to closed
@jrf I've updated the WP_Object_Cache class to explicitly declare the cache_enable property and documented it accordingly. Please review the PR.
@tillkruess commented on PR #7048:
4 weeks ago
#7
@spacedmonkey Can we get this merged?
Check that
cache_enabled
property exists on object cache object.Trac ticket: https://core.trac.wordpress.org/ticket/61675