ID: 39668 Updated by: [EMAIL PROTECTED] Reported By: mehmety at gmail dot com Status: Bogus Bug Type: Date/time related Operating System: Linux PHP Version: 5.2.0 New Comment:
We don't rely on it for the date stuff, but PHP *itself* only handles normal signed integers. The following should work fine: for ( $x = 0; $x < 99; $x++ ) { $year = date_format(date_create( "+$x years" ), "Y"); echo "$x $year\n"; } Previous Comments: ------------------------------------------------------------------------ [2006-11-28 23:56:24] [EMAIL PROTECTED] http://en.wikipedia.org/wiki/Unix_time#32-bit_overflow ------------------------------------------------------------------------ [2006-11-28 23:41:42] mehmety at gmail dot com In that case, the PHP implimentation should not rely on a native function. ------------------------------------------------------------------------ [2006-11-28 22:52:53] [EMAIL PROTECTED] This means you (i.e. the timestamp) have reached the limit of integer. It's known problem and all *nix systems will face it in 2038. Not PHP problem, though. ------------------------------------------------------------------------ [2006-11-28 22:43:36] mehmety at gmail dot com Description: ------------ In order to reproduce this bug, see the below source. Using date and string to time ultimately causes the time to be reset for the year. Seems like deviant behavior. Reproduce code: --------------- php -r 'for($x=0;$x<99;$x++){ $year=date("Y",strtotime("+$x years"));echo "$x $year\n"; } exit();' Expected result: ---------------- {0...98}{today's year + {0...98} } Actual result: -------------- 0 2006 1 2007 2 2008 3 2009 4 2010 5 2011 6 2012 7 2013 8 2014 9 2015 10 2016 11 2017 12 2018 13 2019 14 2020 15 2021 16 2022 17 2023 18 2024 19 2025 20 2026 21 2027 22 2028 23 2029 24 2030 25 2031 26 2032 27 2033 28 2034 29 2035 30 2036 31 2037 32 1969 33 1969 34 1969 35 1969 36 1969 37 1969 38 1969 39 1969 40 1969 41 1969 42 1969 43 1969 44 1969 45 1969 46 1969 47 1969 48 1969 49 1969 50 1969 51 1969 52 1969 53 1969 54 1969 55 1969 56 1969 57 1969 58 1969 59 1969 60 1969 61 1969 62 1969 63 1969 64 1969 65 1969 66 1969 67 1969 68 1969 69 1969 70 1969 71 1969 72 1969 73 1969 74 1969 75 1969 76 1969 77 1969 78 1969 79 1969 80 1969 81 1969 82 1969 83 1969 84 1969 85 1969 86 1969 87 1969 88 1969 89 1969 90 1969 91 1969 92 1969 93 1969 94 1969 95 1969 96 1969 97 1969 98 1969 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39668&edit=1