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
MyBB is not "importing" anything, whatever that means.. It's based on PHP and you or your host or anyone may have installed an additional module, file or even a MyBB plugin ("I don't remember if there are any plugins" doesn't really help us, you can simply check inc/plugins for any extra files if you can't access ACP) which redeclares the error() function. Another possible thing - your installation has bugged files since you made some edits if I read correctly - in that case you can try running File Verfication and replace all changed files with pure MyBB files.
(2015-08-03, 04:49 AM)Destroy666 Wrote: [ -> ]MyBB is not "importing" anything, whatever that means.. It's based on PHP and you or your host or anyone may have installed an additional module, file or even a MyBB plugin ("I don't remember if there are any plugins" doesn't really help us, you can simply check inc/plugins for any extra files if you can't access ACP) which redeclares the error() function. Another possible thing - your installation has bugged files since you made some edits if I read correctly - in that case you can try running File Verfication and replace all changed files with pure MyBB files.

MyBB definitely imports, or includes, or I guess in PHP-terms, requires. This is what I mean - I'm saying it would not randomly require something that's not part of MyBB, so wherever that duplicate error is coming from, it's either in MyBB or in the code PHP libraries.

There are two files in inc/plugins: favcons.php and hello.php (and index.php, but I'm pretty sure that's built-in). I would have said that initially but had no idea I could look there until you mentioned it.

hello.php (which I'm assuming is an included sample plugin) calls error() but does not declare it. favcons.php doesn't even do that.

I made edits to functions.php after this started happening, in an attempt to fix it (changing the "require" statements to "require_once"). I have since restored that file from a fresh download.

Again, everything was working. I didn't visit the forum for a couple of weeks, and when I tried to after that I noticed it was getting this error. Like I said, not a heavily used forum, but the few people who did use it, as well as a few more, would like to get in there again.
(2015-08-03, 04:59 AM)sterlingphoenix Wrote: [ -> ]MyBB definitely imports, or includes, or I guess in PHP-terms, requires. This is what I mean - I'm saying it would not randomly require something that's not part of MyBB, so wherever that duplicate error is coming from, it's either in MyBB or in the code PHP libraries.
MyBB has no influence what PHP "libraries" are used since they are loaded even before any MyBB code is run. PHP-Info may help you to see which PHP version and which extensions are installed.
(2015-08-03, 04:59 AM)sterlingphoenix Wrote: [ -> ]Again, everything was working.
Then you should ask you host what has been changed. We can't know that... MyBB doesn't suddenly add new function itself. Wink
It is still about the redeclaration of error() I presume.

First have a look in your /inc/plugin directory to see which plugins are there. Then concentrate on those you don't have experience with (did not have them running before). Then check whether they have a function error(), which would be an error of course (php has no core function called error).

Alternatively you could try what happens when you give the function error() in inc/functions.php temporarily another name (say error_temp()). Perhaps that at least enables you to enter your AdminCP, and uninstall plugins.
(2015-08-03, 10:22 AM)StefanT Wrote: [ -> ]MyBB has no influence what PHP "libraries" are used since they are loaded even before any MyBB code is run.

This is what I'm saying.

(2015-08-03, 10:22 AM)StefanT Wrote: [ -> ]
(2015-08-03, 04:59 AM)sterlingphoenix Wrote: [ -> ]Again, everything was working.
Then you should ask you host what has been changed. We can't know that... MyBB doesn't suddenly add new function itself. Wink


Yeah, I'm the host (: It's my server. And this is how I know nothing has changed at all with the MyBB installation. Nothing. I don't remember doing anything outlandish with PHP, but since MyBB doesn't require/import anything not within it's own tree, and doesn't try and load any esoteric PHP libraries, my assumption is that error() is now being declared by PHP itself. The problem is that the trace isn't telling me where the conflicting deceleration is!

(2015-08-03, 12:23 PM)Ad Bakker Wrote: [ -> ]It is still about the redeclaration of error() I presume.

That is my assumption.

(2015-08-03, 12:23 PM)Ad Bakker Wrote: [ -> ]First have a look in your /inc/plugin directory

I did - see a few responses above. Nothing there but the sample plugin (which calls error() but doesn't declare it) and a favicons plugin which doesn't even contain the word "error".

(2015-08-03, 12:23 PM)Ad Bakker Wrote: [ -> ]Alternatively you could try what happens when you give the function error() in inc/functions.php temporarily

...I should've thought of that.

It actually works now. Probably screw the hell up if there's an actual error, but...
Pages: 1 2