|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-06 08:52 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 06:00:01 2025 UTC |
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