Creating a php file on myBB is causing a php error.

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
dancore
A regular
A regular
Posts: 34
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Jul 04, 2013 7:55 pm

Creating a php file on myBB is causing a php error.

Post by dancore »

I'm getting this error:

Image

Here is my rules.php:

Code: Select all

<?php

define('IN_MYBB', 1); // (1a)
require_once "./global.php"; // (1b)

add_breadcrumb("Rules page", "rules.php"); // (2)

eval("\$rules = \"".$templates->get("rules")."\";"); // (3)

output_page($rules); // (4)

?>
I've spent the past 3 hours trying to figure this out, apparently it could be the php version causing this, but any help would be highly appreciated. If you require any other information, just let me know!
dancore
A regular
A regular
Posts: 34
Joined: Thu Jul 04, 2013 7:55 pm

Re: Creating a php file on myBB is causing a php error.

Post by dancore »

Btw, if you right click the image and open it in a new tab it'll be easier to read.
User avatar
hiimcody1
Staff
Staff
Posts: 1593
Joined: Wed Dec 28, 2011 4:59 pm

Re: Creating a php file on myBB is causing a php error.

Post by hiimcody1 »

Can you paste the string that is being eval'd?

Specifically the result of this:

Code: Select all

echo $templates->get("rules")
dancore
A regular
A regular
Posts: 34
Joined: Thu Jul 04, 2013 7:55 pm

Re: Creating a php file on myBB is causing a php error.

Post by dancore »

Code: Select all

<html>
<head>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table width="100%" border="0">
<thead>
<tr>
<th>Forum Rules</th>
</tr>
<tbody>
<tr>
<td>Our rules</td>
</tr>
</tbody>
</table>
{$footer}
</body>
</html>
User avatar
hiimcody1
Staff
Staff
Posts: 1593
Joined: Wed Dec 28, 2011 4:59 pm

Re: Creating a php file on myBB is causing a php error.

Post by hiimcody1 »

I believe I see the error.

Try changing

Code: Select all

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

Code: Select all

<title>{$mybb->settings['bbname']}</title>
You may need to track down the specific template file that contains it though.
dancore
A regular
A regular
Posts: 34
Joined: Thu Jul 04, 2013 7:55 pm

Re: Creating a php file on myBB is causing a php error.

Post by dancore »

OMG hahaha you helped me figure this out! For future reference if anyone runs into this problem, I had {$mybb->settings[bbname]} the fix was {$mybb->settings['bbname']} basically just putting bbname in quotes
dancore
A regular
A regular
Posts: 34
Joined: Thu Jul 04, 2013 7:55 pm

Re: Creating a php file on myBB is causing a php error.

Post by dancore »

Thanks a bunch hiimcody1! I really appreciate it!
User avatar
hiimcody1
Staff
Staff
Posts: 1593
Joined: Wed Dec 28, 2011 4:59 pm

Re: Creating a php file on myBB is causing a php error.

Post by hiimcody1 »

I'm glad it ended up being an easy fix :D
doulos9
This is my homepage
This is my homepage
Posts: 200
Joined: Sun Sep 15, 2013 9:44 pm

Re: Creating a php file on myBB is causing a php error.

Post by doulos9 »

I believe that PHP7.2 began issuing that warning. I ran into that a lot when I upgraded to PHP 7.2 from PHP5.6.
Post Reply