[wp-trac] [WordPress Trac] #30448: Customizer Manager/Settings classes do not provide public save method to use outside of customize.php
WordPress Trac
noreply at wordpress.org
Sat Jan 17 00:38:32 UTC 2015
#30448: Customizer Manager/Settings classes do not provide public save method to
use outside of customize.php
-------------------------+------------------------------
Reporter: CrazyJaco | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------------
Comment (by westonruter):
I just realized a big problem with what I had suggested above. In PHP, a
parent class can have a `protected` method and a child class can override
the method with a `public` one. But if a parent class has a `public`
method then the child class must also define that method as `public`. So
here's the problem: there are existing subclasses of
`WP_Customize_Setting` that may define `update` as `protected`, as opposed
to `public`. Although the existing subclasses of `WP_Customize_Setting`,
do indeed for some reason use `public` instead of `protected`. But if any
subclass retains the `protected` visibility, then a fatal error will be
triggered:
{{{#!php
<?php
class WP_Customize_Setting {
public function update() { // before this was protected
// ...
}
}
class WP_Customize_Subsetting extends WP_Customize_Setting {
protected function update() { // PHP Fatal error: Access level to
WP_Customize_Subsetting::update() must be public (as in class
WP_Customize_Setting)
// ...
}
}
}}}
So the question is this: is anyone subclassing `WP_Customize_Setting` and
defining `update` as `protected`? If so, we may need to figure out
another alternative solution.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30448#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list