PHP 7.1 throws warning on block of standard code

6 posts by 2 authors in: Forums > CMS Builder
Last Post: August 8, 2017   (RSS)

By Dave - July 28, 2017

Hi Gary, 

Thanks for reporting that!  I can't recreate it locally.  Which version of CMSB are you using?

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By garyhoffmann - July 29, 2017 - edited: July 29, 2017

Hi Dave - this is with 3.10.

You have to make sure you have all errors/warnings/etc displayed, then you'll see it.  In my own code, I turn on all so I can see things like this while developing a site.

I have several linux servers with a PHP version switcher, so I was able to switch between 7.0 and 7.1 (as well as PHP 5 branch versions).

Supposedly more warnings, etc. have been added to 7.1 that are not present in 7.0. http://php.net/manual/en/migration71.other-changes.php

Gary.

By Dave - August 1, 2017

Hi Gary, 

Hmm, I'm running PHP 7.1.3 on Windows and I can't recreate.   Would you be able to put some debug code in there before that first line that's producing the error? 

print "Debug: \$options['categoryFormat'] = '{$options['categoryFormat']}'<br/>\n"; 
if ($options['categoryFormat'] == 'showall')    { $rootDepthVisible = 'all'; $childDepthVisible = 'all'; $parentVisibility = 'parentBranches'; }

And let me know what the output is?  I don't think categoryFormat should be anything numeric.  

Thanks!

Dave Edis - Senior Developer
interactivetools.com

I don't think it has anything to do with categoryFormat.  When I change rootDepthVisible and childDepthVisible to '999' instead of 'all' that's what removed the warning.  I believe the warning is coming from the fact that these are being used more like numeric later in the code in function _categoryMatchesFormatRules.  I'll see what I can do to get more definitive information.  It's probably a non-issue, but wanted to pass it on in case it does become an issue as PHP continues to tighten it's rules.

By Dave - August 8, 2017

Ok, thanks.  I changed all references of 'all' to 999 to address any potential issues and simplify the code.  Thanks for the feedback!

Dave Edis - Senior Developer
interactivetools.com