MyBB Community Forums

Full Version: PHP warnings showing on all custom pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As of yesterday, I'm now seeing the same PHP warning on all of my custom pages:

https://prnt.sc/r8ltjx

I followed the second half of this guide (Using a separate file) to make my custom pages, so this doesn't seem to be user error. It's also odd that the warnings just started showing yesterday, when they weren't showing before and no edits were made.

Here are the snippets of where the errors are occuring:
<?php

define('IN_MYBB', 1); 
require "./global.php"; 

and

eval("\$faceclaims = \"".$templates->get("faceclaims")."\";");
output_page($faceclaims); 
?>
This warning is caused by a variable that is in one of the templates that is not set in the MyBB code itself for your page. You can fix it either by setting this value (to anything, even a blank string), or add the following to the top of your file. Should solve any remaining issues:

error_reporting(0);
Thanks Darth Apple. error_reporting worked, and I also tried setting any variables I thought would be causing issues to an empty string, but no luck. I'd be curious on how to see which variable is throwing the error so that I can do that workaround if/when myBB upgrades to any future versions of PHP.
It's something related to "bbname" in your template. Eval is interpreting that as a variable and looking for it inside of your custom page. It's not finding any variable (or constant) that is defined with it, so it's throwing the warning.

Removing it from the template should fix the issue as well. I can't really tell with any more detail without actually seeing the template itself.
Ok - now I understand.

 <title>{$mybb->settings[bbname]} - Faceclaims</title>

Was causing it. Wrapping bbname in single quotes resolved the issue. Thank you!