MyBB Community Forums

Full Version: Upgrade to 1.8.33 "failed". Did my templates not get upgraded?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I updated to 1.8.33 from 1.8.27 the update failed. It instructed me to delete the 'install' directory and after doing that the forum was working. CP shows I am on 1.8.33 (PHP 8.1.14, SQL engine MySQLi 5.7.38).

Since then I've been getting e-mailed a lot of "Undefined variable $..." errors.

I'm only running the default/stock templates.

I did a file verification and it returns back "Congratulations! No corrupt files have been found on your installation."

Now, one of the many errors shows "Undefined variable $attach_mod_options". A log entry for that has this:
<error>
	<dateline>1676071753</dateline>
	<script>newreply.php(234) : eval()'d code</script>
	<line>5</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined variable $attach_mod_options</message>
	<back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [/newreply.php(234) : eval()'d code:5]
#2  eval() called at [/newreply.php:234]
</back_trace>
</error>

I searched the database and I was able to find a reference to that variable in it. I also searched the mybb_theme.xml from the 1.8.33 install zip and it has this with a variable "$attach_mod_options" in it.
<tr id="attachment_{$attachment['aid']}">
<td class="trow2" width="1" align="center">{$attachment['icon']}</td>
<td class="trow2" width="60%" style="white-space: nowrap"><span class="attachment_filename">{$attachment['filename']}</span> ({$attachment['size']})</td>
<td class="trow2" style="white-space: nowrap; text-align: center;">{$attach_mod_options} {$attach_rem_options} {$postinsert}</td>
</tr>

I've been reading several posts with solutions/suggestions so I tried inserting $attach_mod_options = "" in the newreply.php file at line 227, yet I'm still getting the error. Many more posts say the problem is with your templates. Since I've never installed new templates and have always used the stock templates, did the failure I got when upgrading not update my templates? If that's the case, how do I re-install the default templates? If not, how do I fix these errors from getting e-mailed (beside turning off the e-mail, I'm pretty sure my error.log file will continue to grow)?
I don't think it's failed, but strange this error hasn't come up before. It should be fixed by putting the line you added before this:

eval("\$attemplate = \"".$templates->get("post_attachments_attachment")."\";");

Does need to be fixed in core though.
I did what you suggested and that fixed that particular problem. For the past few days I've been going through the logs and applying the same type of fix to a bunch of other files that are doing the same thing. I've managed to get most of the them, but there's a couple I don't know how to fix:

<error>
	<dateline>1676729966</dateline>
	<script>printthread.php(288) : eval()'d code</script>
	<line>2</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined property: MyLanguage::$archive_pages</message>
	<back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [/printthread.php(288) : eval()'d code:2]
#2  eval() called at [/printthread.php:288]
#3  printthread_multipage() called at [/printthread.php:118]
</back_trace>
</error>

The printthread.php file I had already made a change by adding $archive_pages="" that got rid of the undefined variable error:
115: if($postcount > $perpage)
116: {
117: 	$archive_pages = "";
118:	$multipage = printthread_multipage($postcount, $perpage, $page, "printthread.php?tid={$tid}");
119: }
120: else
121: {
122: 	$multipage = '';
123: }


and

<error>
	<dateline>1676761460</dateline>
	<script>showthread.php</script>
	<line>338</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Trying to access array offset on value of type null</message>
	<back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [/showthread.php:338]
</back_trace>
</error>

I made some changes to the showthread.php file, but this area wasn't one of them. In the old logs I recall seeing some errors come in about an invalid property 'tid' or something to that effect:
337:	// Are there actually next newest posts?
338:	if(!$nextthread['tid'])
339:	{
340:		error($lang->error_nonextnewest);
341:	}
(2023-02-14, 12:15 PM)Matt Wrote: [ -> ]I don't think it's failed, but strange this error hasn't come up before. It should be fixed by putting the line you added before this:

eval("\$attemplate = \"".$templates->get("post_attachments_attachment")."\";");

Does need to be fixed in core though.

This same problem also exists in newthread.php
Undefined variable $attach_mod_options at line 189 in forum/newthread.php

Find at line 189 and replace
			eval("\$attemplate = \"".$templates->get("post_attachments_attachment")."\";");
with
			$attach_mod_options = '';
			eval("\$attemplate = \"".$templates->get("post_attachments_attachment")."\";");