MyBB Community Forums

Full Version: Cannot redeclare error()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi guys,

My forum started returning the above error. I'm not sure when... it wasn't super-heavily used (in fact I made it to crack a joke) so no modifications to the forum itself, but something might've been upgraded on the system.

I tried searching but sadly the word "error" makes it kind of hard to search for.

I'm using mybb 1805. Upgraded from 1804 (which was a clean install) in hopes that it'll help.
Forum is at http://www.freakzilla.com/qsn/
Error text:

( ! ) Fatal error: Cannot redeclare error() in /usr/local/web/sites/freakzilla.com/qsn/inc/functions.php on line 783
Call Stack
# Time Memory Function Location
1 0.0035 236696 {main}( ) ../index.php:0
2 0.0094 454200 require_once( '/usr/local/web/sites/freakzilla.com/qsn/global.php' ) ../index.php:18
3 0.0105 456376 require_once( '/usr/local/web/sites/freakzilla.com/qsn/inc/init.php' ) ../global.php:18
does it has any active plugins ? can you log into forum admin panel & navigate around without any issues ?
(2015-08-02, 05:31 PM).m. Wrote: [ -> ]does it has any active plugins ? can you log into forum admin panel & navigate around without any issues ?

This will sound stupid, but I don't remember if there are any plugins. I /think/ I just set it up and changed some colours/themes.

Going to /admin/ gives a similar error (only two call stack lines rather than 3).
can you replace ~/inc/functions.php file from a fresh download of MyBB 1.8.5 & check the result
(2015-08-02, 06:16 PM).m. Wrote: [ -> ]can you replace ~/inc/functions.php file from a fresh download of MyBB 1.8.5 & check the result

Done, same issue ):

I actually did edit functions.php; I replaced all the "require" with "require_once". But sadly reverting to the original (which I did copy off a fresh download) did not help ):
^ if you need direct help then you may PM me temporary access to files (FTP) to check the issue.
however now its late midnight for me and I can check it in about 10 hours from now
MyBB defines a function called error(). You may have installed something else that also uses that name since it's not really unique. You need to track it down and either rename it or remove it.
(2015-08-03, 02:46 AM)Destroy666 Wrote: [ -> ]MyBB defines a function called error(). You may have installed something else that also uses that name since it's not really unique. You need to track it down and either rename it or remove it.

I'd imagine that's what happened, but it'd have to be part of PHP's core, right? Otherwise mybb wouldn't be importing it. Either way, the stack trace is only showing mybb files. If it could be anywhere, in any PHP subsystem, it'll be hellish to find... be easier to do a global find/replace on the word "error" within mybb (:
(2015-08-03, 03:09 AM)sterlingphoenix Wrote: [ -> ]I'd imagine that's what happened, but it'd have to be part of PHP's core, right?

Not at all.. In that case no MyBB forum including this would work.

(2015-08-03, 03:09 AM)sterlingphoenix Wrote: [ -> ]Either way, the stack trace is only showing mybb files.

Because there's only one duplicate definition and only the 2nd is shown as erroneous.
EDIT: PHP is actually smarter than I thought and the error should inform you about the other definition with something like (previously declared in /path/to/the/file.php:123) - check that in the error log

(2015-08-03, 03:09 AM)sterlingphoenix Wrote: [ -> ]If it could be anywhere, in any PHP subsystem, it'll be hellish to find... be easier to do a global find/replace on the word "error" within mybb (:

It may be hard to find, but replacing every error() in MyBB isn't the best solution either. If you forget to do that in just one plugin uploaded after some time, the error will reappear. And you'd have to do that after each upgrade too.
(2015-08-03, 04:25 AM)Destroy666 Wrote: [ -> ]Not at all.. In that case no MyBB forum including this would work.

Yeah, but it's something mybb is importing, and why would it import some random piece of php that's NOT part of php's core?...

(2015-08-03, 04:25 AM)Destroy666 Wrote: [ -> ]EDIT: PHP is actually smarter than I thought and the error should inform you about the other definition with something like (previously declared in /path/to/the/file.php:123) - check that in the error log

Yes, it definitely should - but there is nothing in the error log at all. The access log shows a 200 on this... is there some extra debugging I need to turn on?...
Pages: 1 2