ID: 47892 Updated by: j...@php.net Reported By: tommykvoom at gmail dot com -Status: Open +Status: Bogus Bug Type: PHP options/info functions Operating System: Linux PHP Version: 5.2.9 New Comment:
Because PHP 5 is more strict about it. This is not a bug. Previous Comments: ------------------------------------------------------------------------ [2009-04-03 17:32:13] tommykvoom at gmail dot com Description: ------------ Question ... Why does this return an error with PHP5, but not with PHP4: # PHP Warning [PHP]:: mktime() expects parameter 3 to be long, string given in file /home/web20con/public_html/netoffice/includes/library.php line 931 In this code: (as referenced in the error msg above) function createDate($storedDate, $gmtUser) { global $gmtTimezone; if ($gmtTimezone == 'true') { if ($storedDate != '') { $extractHour = substr($storedDate, 11, 2); $extractMinute = substr($storedDate, 14, 2); $extractYear = substr($storedDate, 0, 4); $extractMonth = substr($storedDate, 5, 2); $extractDay = substr($storedDate, 8, 2); return(date("Y-m-d H:i", mktime($extractHour + $gmtUser, $extractMinute, '', $extractMonth, $extractDay, $extractYear))); } } else { return($storedDate); } } Reproduce code: --------------- --- >From manual page: function.mktime --- Question ... Why does this return an error with PHP5, but not with PHP4: # PHP Warning [PHP]:: mktime() expects parameter 3 to be long, string given in file /home/web20con/public_html/netoffice/includes/library.php line 931 In this code: (as referenced in the error msg above) function createDate($storedDate, $gmtUser) { global $gmtTimezone; if ($gmtTimezone == 'true') { if ($storedDate != '') { $extractHour = substr($storedDate, 11, 2); $extractMinute = substr($storedDate, 14, 2); $extractYear = substr($storedDate, 0, 4); $extractMonth = substr($storedDate, 5, 2); $extractDay = substr($storedDate, 8, 2); return(date("Y-m-d H:i", mktime($extractHour + $gmtUser, $extractMinute, '', $extractMonth, $extractDay, $extractYear))); } } else { return($storedDate); } } Expected result: ---------------- No errors. This bug appears in the open source program NetOffice Version : 2.6.0b2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47892&edit=1