Page 1 of 1

Error in Birthday calender

Posted: 16. January 2011 13:50
by MaxxHoorn
Your Portal Version: 1.0.6
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge
Boardlink: http://www.seriejunkies.nl

PHP Version: 3.0.7-PL1

What have you done before the problem was there?
Nothing related to the portal and/or birthdayblock phpcode.

What have you already tryed to solve the problem?
Nothing. Disabled the birthday-block so the error won't show.

Description and Message
Portal shows an error message.

Code: Select all

[phpBB Debug] PHP Notice: in file /portal/includes/functions.php on line 630: mktime() [function.mktime]: Windows does not support negative values for this function
I think it has to do with a specific date or an invalid date a user filled out for his/her birthday. I didn't change anything on the mod settings and in the previous week it worked correctly.[/i]

Re: Error in Birthday calender

Posted: 16. January 2011 15:45
by archivar
Compare this code in in file /portal/includes/functions.php

Code: Select all

function format_birthday($date, $format = false)
{
	global $user;
		$time->time_now	= time();
		$lang_dates		= $user->lang['datetime'];
		$format			= (!$format) ? $time->date_format : $format;

		// Short representation of month in format
		if ((strpos($format, '\M') === false && strpos($format, 'M') !== false) || (strpos($format, '\r') === false && strpos($format, 'r') !== false))
		{
			$lang_dates['May'] = $lang_dates['May_short'];
		}
		unset($lang_dates['May_short']);
		
	// We need to create a UNIX timestamp for date()
	$day = substr($date, 0, strpos($date, '-'));
	$month = substr($date, (strpos($date, '-')+1), 2);
	$year = substr($date, -4);
	$birthday_time = mktime(0, 0, 0, $month, $day, $year);

	return strtr(@date(str_replace('|', '', $format), $birthday_time), $lang_dates);
}
and write is different or the same.

Re: Error in Birthday calender

Posted: 16. January 2011 16:19
by MaxxHoorn
It's the same. Is that good or bad? :)

Re: Error in Birthday calender

Posted: 16. January 2011 16:39
by archivar
MaxxHoorn wrote:It's the same. Is that good or bad? :)
That's good.
Test if it is error-free in the Forum Index.

Re: Error in Birthday calender

Posted: 16. January 2011 17:10
by MaxxHoorn
It works on the forumindex, no error.

I think on the forumindex only users with their birthday today are shown, while on the portal users who have their birthday this week are shown. So I might get an error on the index later this week (hopefully not ofcourse).

Re: Error in Birthday calender

Posted: 16. January 2011 18:18
by archivar
You can enter your birthday on this day.
For a short time.

Re: Error in Birthday calender

Posted: 16. January 2011 18:48
by MaxxHoorn
I know, I tried that and it works.

What I meant was that at the index it only looks at this day. On the portal it shows the whole week. I thought maybe someone has used an invalid date, for a day later this week. For example: 18 jan 2012, which is in the future and it would calculate an age of -1 (a negative value). At the index it would only show on january 18th, but because the portal shows all birthdays of the week, an error might occour.

I'm purely speculating, I don't have any programming skills. :)

Re: Error in Birthday calender

Posted: 16. January 2011 23:23
by Marc
I'll take a look at it. ;)

Re: Error in Birthday calender

Posted: 19. January 2011 19:36
by Marc
This is caused by your PHP version in combination with your Windows machine. If you want it to work, update your PHP version.