Website Comments 1.05 Error - Trying to access array offset on value of type bool

6 posts by 4 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 13   (RSS)

By craig_bcd - June 17

Hi -

I started getting this error with website comments 1.05 just out of the clear blue sky (I am sure something happened I just don't know what) 

On the website it shows up like this:

Notice: Trying to access array offset on value of type bool in /home/customer/www/delanceyplace.com/public_html/cmsAdmin/plugins/websiteComments/websiteComments.php on line 279

In the error log it shows up like this: 

 E_NOTICE: Trying to access array offset on value of type bool
/home/customer/www/delanceyplace.com/public_html/cmsAdmin/plugins/websiteComments/websiteComments.php (line 279)
https://delanceyplace.com/view-search-results.php?2509

It looks like the error is in the plugin itself.

We are running:

  • CMS Builder v3.53 (Build 2265)
  • Website comments 1.05
  • PHP v7.4.18

Can you guys help?

Thanks!

Craig

By Steve99 - June 17

Hi Craig,

I could be wrong, but it sounds like the function "wsc_thread_isSubscribed" might be getting called on your page code before checking if a site visitor is logged in. I signed up a test account and no longer saw the error after being logged in.

Could do something like this for things that require a user to be logged in:

if (@$CURRENT_USER) { 
// do stuff like checking if subscribed to current post
}

Also, I noticed you are running cmsb 3.53 on php7.4 and I believe 7.4 compatibility was added in 3.54. I suppose it's possible that a php version change may have presented the error in handling code differently. Could try updating as well.

Hopefully this helps. Let me know how you make out.

Best,
Steve

By craig_bcd - June 17

Steve!

You are genius!  I changed the PHP version to 7.3 and the error magically disappeared!  I'll look to upgrade to 3.54.

Thanks!

Craig

By degreesnorth - July 8

Hi

I am getting this error as well, after upgrading my client's CMS/PHP.  It appears at the top of the cmsb login screen.  

CMS Builder v3.50 (Build 2215)
PHP v7.4.12

Is there any way of fixing this issue please?

Notice: Trying to access array offset on value of type bool in /home/gege1237/public_html/cmsb/lib/menus/header_functions.php on line 167 Notice: Trying to access array offset on value of type bool in /home/gege1237/public_html/cmsb/lib/menus/header_functions.php on line 167 Notice: Trying to access array offset on value of type bool in /home/gege1237/public_html/cmsb/lib/menus/header_functions.php on line 167

By daniel - July 13

Hi degreesnorth,

This particular issue should be resolved in newer versions of CMSB. You can find the details of the latest release here: https://www.interactivetools.com/forum/forum-posts.php?CMSB-v3.54-Released---October-29-2020-82341

If you're unable to upgrade currently, you can also fix this error with a simple patch. In /cmsb/lib/menus/header_functions.php, replace this line (line 167):

  elseif (@$menu['visibility'] == 'requireAdmin' && $CURRENT_USER['isAdmin'])                           { $userHasMenuAccess = true; } // allow access to admin for admin menus

With this:

  elseif (@$menu['visibility'] == 'requireAdmin' && !empty($CURRENT_USER['isAdmin']))                   { $userHasMenuAccess = true; } // allow access to admin for admin menus

Note that there may be other PHP 7.4 compatibility issues in CMSB 3.50, so I would still recommend upgrading if possible.

Let me know if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com