Login | Sign up | Toll-Free: 1-800-752-0455



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

There is a block of standard code that seems to throw warnings in PHP 7.1 (not PHP 7.0, however) (CMSB 3.10)

(from viewer_functions.php at or about line 835)

if      ($options['categoryFormat'] == 'showall')    { $rootDepthVisible = 'all'; $childDepthVisible = 'all'; $parentVisibility = 'parentBranches'; }
  else if ($options['categoryFormat'] == 'onelevel')   { $rootDepthVisible = '1';   $childDepthVisible = '1';   $parentVisibility = 'parentBranches'; }
  else if ($options['categoryFormat'] == 'twolevel')   { $rootDepthVisible = '2';   $childDepthVisible = '1';   $parentVisibility = 'parentBranches'; }
  else if ($options['categoryFormat'] == 'breadcrumb') { $rootDepthVisible = '0';   $childDepthVisible = '0';   $parentVisibility = 'parentsOnly'; }
  else { die("Unknown category format '" .htmlencode($options['categoryFormat'])."'!"); }

I get invalid numeric warnings on the first line of this block.

Warning: A non-numeric value encountered (then it gives the name of the routine and the line number)

In playing with this, if I change the 'all' value to '999' for the two depth values, it works fine.  I'm guessing something is trying to coerce these values into numeric.

It's not a big deal since I use my own viewer functions and was able to change it anyway without affecting standard code, but I just wanted to point it out.

I don't have a small test case to show this, sadly.  Sorry.

Hi Gary, 

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


Dave Edis - Senior Developer

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


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.  


Dave Edis - Senior Developer

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.