2008-06-28, 10:07 PM
Description:
If you add an announcement both from the admincp and the modcp and select a month before November and save that. It will automatically change back to January (1).
Reproducible: always
Steps to reproduce:
1) Go to AdminCP > Forums & Posts > Announcements and click Add Announcement
2) Choose any month from January until October.
3) Fill in the other required fields
4) Save the announcement
5) Click on the edit-link for the announcement you just created
6) The month is changed to January.
I think the problem is this piece of code:
I'm sorry if this was already reported but I couldn't find any thread of this.
[EDIT]
Oh yeah, I'm using PHP 5.2.6.
If you add an announcement both from the admincp and the modcp and select a month before November and save that. It will automatically change back to January (1).
Reproducible: always
Steps to reproduce:
1) Go to AdminCP > Forums & Posts > Announcements and click Add Announcement
2) Choose any month from January until October.
3) Fill in the other required fields
4) Save the announcement
5) Click on the edit-link for the announcement you just created
6) The month is changed to January.
I think the problem is this piece of code:
if($mybb->input['starttime_month'] > 12 ||
(int)$mybb->input['starttime_month'] < 1 ||
!is_int($mybb->input['starttime_month']))
{
$mybb->input['starttime_month'] = 1;
}
This is from /admin/modules/forum/announcements.php but I think there is also similar code in modcp.php. is_int() will always return false on a POST/GET variable because it's always text.var_dump( is_int( 4 ) ); // bool(true)
var_dump( is_int( '4' ) ); // bool(false)
var_dump( is_int( '04' ) ); // bool(false)
So the if statement above will always return true:$mybb->input['starttime_month'] > 12 === '04' > 12 === false
(int)$mybb->input['starttime_month'] < 1 === '04' < 1 === false
!is_int($mybb->input['starttime_month']) === !is_int('04') === true
false || false || true === true
I'm sorry if this was already reported but I couldn't find any thread of this.
[EDIT]
Oh yeah, I'm using PHP 5.2.6.