backdrop-contrib / og

The Organic Groups module provides users the ability to create, manage, and delete 'groups' on a site.
GNU General Public License v2.0
1 stars 8 forks source link

Notice: Trying to access array offset on value of type bool in og_context_determine_context() #135

Closed olafgrabienski closed 1 year ago

olafgrabienski commented 1 year ago

After upgrading a site from D7 to Backdrop, I see the following notice on many pages of the Backdrop site:

Trying to access array offset on value of type bool in og_context_determine_context() (line 450 of modules/og/og_context/og_context.module)

There is a D7 issue which was fixed about two years ago. There hasn't been a new D7 Organic Groups release since then, so the fix was only committed to the dev branch.

olafgrabienski commented 1 year ago

Applying the D7 fix to Backdrop by changing https://github.com/backdrop-contrib/og/blob/1.x-2.x/og_context/og_context.module#L450 from

if (strpos($item['path'], $path) === 0) {

to

if ($item && strpos($item['path'], $path) === 0) {

fixes the issue for me.

argiepiano commented 1 year ago

Thanks, @olafgrabienski. This looks like the correct fix. Would you like to submit a PR? :)

olafgrabienski commented 1 year ago

Sure, PR submitted: https://github.com/backdrop-contrib/og/pull/136

argiepiano commented 1 year ago

Thank you much, @olafgrabienski! LGTM. @laryn, should I go ahead and merge?

laryn commented 1 year ago

LGTM too -- thanks @olafgrabienski!

argiepiano commented 1 year ago

Thanks! Merged!