s9y / Serendipity

A PHP blog software
https://s9y.org
BSD 3-Clause "New" or "Revised" License
203 stars 86 forks source link

serendipity_event_imageselectorplus: Undefined array key #850

Open bauigel opened 1 month ago

bauigel commented 1 month ago

With current git-master I get an error

Warning: Undefined array key "ep_disable_markup_serendipity_event_imageselectorplus:34ba0343cf0d7f01a68354358af1be85" in /plugins/serendipity_event_imageselectorplus/serendipity_event_imageselectorplus.php on line 594.

Fix seems to be easy, there is just an isset missing. I changed the line from

!$eventData['properties']['ep_disable_markup_' . $this->instance] &&

to

!isset($eventData['properties']['ep_disable_markup_' . $this->instance]) &&
onli commented 1 month ago

The new check would only be false when $eventData['properties']['ep_disable_markup_' . $this->instance] is not set at all. But it would evaluate to true when $eventData['properties']['ep_disable_markup_' . $this->instance] is set, but set to false.

The correct check should be:

(!isset($eventData['properties']['ep_disable_markup_' . $this->instance]) || !$eventData['properties']['ep_disable_markup_' . $this->instance]) &&

Better to test it though, it's too easy to mix expressions like that up :/