jeremybubbleup
Forum Replies Created
-
Forum: Plugins
In reply to: [Easy Appointments] Can’t Filter AppointmentsI fixed this problem in my installation of the plugin, but that means I can’t update the plugin lest it Break again.
Here is the fix to be put in place as soon as the developer pays attention to this ticket:In src/dbmodels.php on what is currently line 153, the property of a ‘field’ object with the name $f->slug is assigned the value $f->value. HOWEVER, no checks are made so when $f->slug is an empty string, which it most certainly can be and sometimes IS, a fatal error is met (you cannot set an empty property; that is, one whose name is an empty string). I have a very basic setup of this plugin and have only been using it for 1 month, so this is likely not a rare case. Even if it is, the code should be responsible and check for invalid values like this.
To fix it I replaced:if (!empty($ids)) {
$fields = $this->get_fields_for_apps($ids);foreach ($fields as $f) {
if (array_key_exists($f->app_id, $apps)) {
$apps[$f->app_id]->{$f->slug} = $f->value;
}
}
}// With :
if (!empty($ids)) {
$fields = $this->get_fields_for_apps($ids);foreach ($fields as $f) {
if (array_key_exists($f->app_id, $apps)) {
// This was breaking because $f->slug was sometimes an empty string, which cannot be a property of the object in the array.
if (isset($f->app_id)&&!empty($f->app_id) && isset($f->slug)&&!empty($f->slug) && isset($f->value)&&!empty($f->va$
$apps[$f->app_id]->{$f->slug} = $f->value;
}
}
}