MyBB Community Forums

Full Version: error on first login after install
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm using php 5.3 witch is probably the problem. however, more people seem to be using mybb forums with php 5.3.

i tried to install the 1.4.9 version directly (so no updates or anything). I went to http://community.mybboard.net/thread-521...#pid372017 and applied the fixes there. The installation went fine (I did get some warnings about not using local time or something similar, but i don't think that has anything to do with this problem). When I got to the forum (http://exyle.uni.cc:7070/forum/) everything seemed to work until i try to login. Then i got an error

Error Type: (8192)
Error Message: Function split() is deprecated
Location: File: inc/functions.php; Line: 1652

Code:
1649. }
1650.
1651. $load = @exec("uptime");
1652. $load = split("load averages?: ", $load);
1653. $serverload = explode(",", $load[1]);
1654. if(!is_array($serverload))
1655. {
Backtrace:
File Line Function
/inc/class_error.php 171 errorHandler->output_error
[PHP] errorHandler->error
/inc/functions.php 1652 split
/inc/functions.php 46 get_server_load
/index.php 338 output_page


I guess the 8192 means it is caused because I use php 5.3. Though i have no idea what part of the code should be changed. I don't feel like going trough all those files and see if i can fix it myself (witch i probably can't) and i don't see anything like '&new' that i can change.
i tried the "$load = @exec("uptime"); $load = split("load averages?: ", $load);" part in a separate php script. but it seems to work.

I know 1.4.9 is not fully compatible with php 5.3 but i hope someone who knows something about the code could give me a quick fix for this.

oh the error only occures when i have cookies set on my pc. if i remove the cookies, i get the guest page again without any errors. perhaps there is something worng with the way cookies are parsed. don't know just guessing.

if there is anything else you need to know just ask.

thanks in advance.
I know that split() has been deprecated but I can't remember anyone else having this error, which is weird... I'll see if a dev can confirm whether or not it's something we've missed. Are you sure you applied all the fixes in that post??
i removed the split with preg_split witch seemd to work,

i don't know exactly if that does solve it, i did a search on php manuals themselves .... i can only hope :


to answer your questions, no no plugins clean install, and yes i did all the patched described.
(2009-10-13, 07:31 AM)honril Wrote: [ -> ]to answer your questions, no no plugins clean install, and yes i did all the patched described.

Sorry, I edited out the bit about plugins, Windows Explorer search told me split wasn't used anywhere, which was a bit confusing Shy
I did a search too but came up with nothing. Stupid Windows.

I'll have a look later today and commit some sort of fix...
OK, here's the fix. I went for explode, instead of preg_split - that function is more for regex and stuff like that and abit OTT for this function (IMO).

Around line 1652, change

$load = split("load averages?: ", $load);

to:

$load = explode("load average: ", $load);

Should work without any problems.
@ MattRogowski, thanks for the quick reply, Smile

@ tomm M, thanks for the fix.

though i wonder, when just run split in php 5.3 i won't get any error, but when it is used inside the mybb scripts it stops the whole thing. Is there like an option set for debugging purposes that gives these errors. cus the function in it self works.

(i know it will be removed in 6.0, and that it is deprecated, but still. perhaps just let the forums use whatever they are using and test for deprecated function separately IF this has something to do with some kind of debugging options.)
You'd need to set the error_reporting to show e_deprecated errors, I think - otherwise they won't show.

We'd rather replace the deprecated functions with something that will work for 5.3 and 6.0, rather than just hiding them. Smile
haha yeah i get that but when you actually use a forum it's a bit annoying :d.


humm as a side note, when someone registers on my forum they get a series of warnings:

Warning [2] date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead - Line: 1724 - File: inc/functions.php PHP 5.3.0 (Linux)

File Line Function
[PHP] errorHandler->error
/inc/functions.php 1724 date
/inc/datahandlers/user.php 994 update_stats
/member.php 238 UserDataHandler->insert_user

// Update stats row for today in the database
$todays_stats = array(
	"dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
	"numusers" => $stats['numusers'],
	"numthreads" => $stats['numthreads'],
	"numposts" => $stats['numposts']
);
$db->replace_query("stats", $todays_stats, "dateline");

$cache->update("stats", $stats, "dateline");

and i have no idea how to fix that :s. According to the php manual (http://php.net/manual/en/function.mktime.php):
5.3.0 - mktime() now throws E_DEPRECATED notice if the is_dst parameter is used.

i don't know if that's the problem. maybe the timezone was never set by date_default_timezone_set(). I don't know if that should have happend or not. But when i change the few lines from above to
// Update stats row for today in the database
date_default_timezone_set('UTC');
$todays_stats = array(
	"dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
	"numusers" => $stats['numusers'],
	"numthreads" => $stats['numthreads'],
	"numposts" => $stats['numposts']
);
$db->replace_query("stats", $todays_stats, "dateline");

$cache->update("stats", $stats, "dateline");

the errors seem to be gone. my guess is that the timezone was never set, or not set properly. maybe i olive up some settings on my board, though i wouldn't know where to look for that. (i've only been using these forums for 2 days now).

anyway if someone has any idea on what caused this??

thanks in advance
Yeah, you need to set the timezone settings in php.ini correctly. As soon as I had changed them those errors disappeared and worked fine for me.

If PHP is configured correctly, you shouldn't see them.

If you have it set correctly, and it still doesn't work, let us know...
Pages: 1 2