2025-01-25, 06:15 PM
If a thread is made in a forum that does not permit polls, a warning may be thrown.
<error>
<dateline>1735863272</dateline>
<datetime>2025-01-03 00:14:32 UTC -0700</datetime>
<script>newthread.php(1171) : eval()'d code</script>
<line>37</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>Undefined variable $pollbox</message>
<back_trace>#0 errorHandler->error() called at [/inc/class_error.php:153]
#1 errorHandler->error_callback() called at [/newthread.php(1171) : eval()'d code:37]
#2 eval() called at [/newthread.php:1171]
</back_trace>
</error>
Line 1171 evaluates the newthread template which contains the evaluated pollbox template performed at line 1096.
The condition may not cause the pollbox template to be evaluated, throwing the warning.
Initialize $pollbox before line 1093 by adding
If a new thread is created in a forum which does not permit attachments, a warning is thrown.
<error>
<dateline>1735925296</dateline>
<datetime>2025-01-03 17:28:16 UTC -0700</datetime>
<script>newthread.php</script>
<line>163</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>Undefined array key "attachments"</message>
<back_trace>#0 errorHandler->error() called at [/inc/class_error.php:153]
#1 errorHandler->error_callback() called at [/newthread.php:163]
</back_trace>
</error>
Line 163 is a long line of conditionals and is difficult to read.
This is its equivalent multiline code.
$_FILES['attachments'] may not be set.
Find in line 163 near the end
<error>
<dateline>1735863272</dateline>
<datetime>2025-01-03 00:14:32 UTC -0700</datetime>
<script>newthread.php(1171) : eval()'d code</script>
<line>37</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>Undefined variable $pollbox</message>
<back_trace>#0 errorHandler->error() called at [/inc/class_error.php:153]
#1 errorHandler->error_callback() called at [/newthread.php(1171) : eval()'d code:37]
#2 eval() called at [/newthread.php:1171]
</back_trace>
</error>
Line 1171 evaluates the newthread template which contains the evaluated pollbox template performed at line 1096.
The condition may not cause the pollbox template to be evaluated, throwing the warning.
Initialize $pollbox before line 1093 by adding
$pollbox = "";
If a new thread is created in a forum which does not permit attachments, a warning is thrown.
<error>
<dateline>1735925296</dateline>
<datetime>2025-01-03 17:28:16 UTC -0700</datetime>
<script>newthread.php</script>
<line>163</line>
<type>2</type>
<friendly_type>Warning</friendly_type>
<message>Undefined array key "attachments"</message>
<back_trace>#0 errorHandler->error() called at [/inc/class_error.php:153]
#1 errorHandler->error_callback() called at [/newthread.php:163]
</back_trace>
</error>
Line 163 is a long line of conditionals and is difficult to read.
This is its equivalent multiline code.
if($mybb->settings['enableattachments'] == 1 &&
($mybb->get_input('newattachment') || $mybb->get_input('updateattachment') ||
((($mybb->input['action'] == "do_newthread" && $mybb->get_input('submit')) ||
($mybb->input['action'] == "newthread" && isset($mybb->input['previewpost'])) ||
isset($mybb->input['savedraft'])) && $_FILES['attachments'])))
$_FILES['attachments'] may not be set.
Find in line 163 near the end
$_FILES['attachments'])))
and replace with isset($_FILES['attachments']))))