MyBB Community Forums

Full Version: gmmktime() expects parameter 6 to be long, string given
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
After upgrading to MyBB latest version, 1.6.10, I got many errors like these :

Your copy of MyBB running on ValueBuddies.com : Value Investing Forum - Singapore, Hong Kong, U.S. (http://www.valuebuddies.com) has experienced an error. Details of the error include:
---
Type: 2
File: calendar.php (Line no. 1827)
Message
gmmktime() expects parameter 6 to be long, string given


Your copy of MyBB running on ValueBuddies.com : Value Investing Forum - Singapore, Hong Kong, U.S. (http://www.valuebuddies.com) has experienced an error. Details of the error include:
---
Type: 2
File: calendar.php (Line no. 1855)
Message
gmmktime() expects parameter 6 to be long, string given

Please help. Thanks.
let me add a couple of links here for the experts to rediscover the cause

http://community.mybb.com/calendar-1-wee...72000.html
http://community.mybb.com/calendar-1-wee...84000.html
EDIT: nvm, change it back, didn't notice another things
Also I can't reproduce it on localhost with the same links, may be PHP version dependent.

Try also this:
	$week_from = explode("-", gmdate("j-n-Y", $mybb->input['week']));
To:
	$week_from = array_map('intval', explode("-", gmdate("j-n-Y", $mybb->input['week'])));

And:
	$week_to = explode("-", gmdate("j-n-Y-t", $week_to_stamp));
To:
	$week_to = array_map('intval', explode("-", gmdate("j-n-Y-t", $week_to_stamp)));

But that's again quick view and may not work/cause troubles, I rather recommend filling out a bug report and letting experienced developer to deal with it.
(2013-06-08, 06:15 AM)Destroy666 Wrote: [ -> ]Open calendar.php and try to change
	$week_from_one = $week_from[1];
To:
	$week_from_one = (int) $week_from[1];

Dear Destry666,

I have modified as you said, but it cannot solve the problem.

Dear Destroy666,

Casting at the parameter level solves the problem.

line 1827 is modified to $week_to_stamp = gmmktime(0, 0, 0, $week_from[1], $week_from[0]+6, (int) $week_from[2]);
line 1855 is modified to $events_from = gmmktime(0, 0, 0, $week_from[1], 1, (int) $week_from[2]);

But I wonder if there is a better solution ?
A few days ago I got the same error messages when I was still on MyBB 1.6.9.
I upgraded to 1.6.10, but nothing changed, until now I got more than 500 error-mails.

My PHP version is 5.2.12-nmm4, the SQL engine is MySQLi 4.1.22.

I just applied cyclone's fix, hopefully it helps...