Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12894 closed defect (bug) (invalid)

mktime inconsistent between 2.9 and 3.0

Reported by: arena's profile arena Owned by: arena's profile arena
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

on the same pc, same environment :

with 2.9

mktime( 0, 0, 0, 04, 8, 2010 ) gives 1270677600 (Wednesday, April 7th 2010, 22:00:00 (GMT))

with 3.0beta1

mktime( 0, 0, 0, 04, 8, 2010 ) gives 1270684800 (Thursday, April 8th 2010, 00:00:00 (GMT))

Change History (10)

#1 follow-up: @scribu
15 years ago

  • Keywords reporter-feedback added; dev-feedback removed

The second one appears to be correct, so what's the problem?

It's probably the effect of [12727]

#2 in reply to: ↑ 1 @arena
15 years ago

Replying to scribu:

The second one appears to be correct, so what's the problem?

It's probably the effect of [12727]

My PHP settings are (php.ini)

[Date]
; Defines the default timezone used by the date functions
date.timezone =Europe/Paris

and my wordpress settings are :

Timezone : Paris which is equivalent to UTC+2
UTC time is 2010-04-07 20:34:07 Local time is 2010-04-07 22:34:07

The first is the right one (http://fr.php.net/mktime).

so the 04/08/2010 00:00 local time is 07/04/2010 22:00:00 GMT

#3 @arena
15 years ago

sorry, last line of my previous post should be

so the 04/08/2010 00:00 local time is 04/07/2010 22:00:00 GMT

retauring [12727] doesn't change a thing !!!

#4 @arena
15 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#5 follow-up: @scribu
15 years ago

  • Milestone 3.0 deleted

So what was the issue?

#6 in reply to: ↑ 5 @arena
15 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to scribu:

So what was the issue?

still don't know, i made several attempts to have my plugin code as clean as possible and the error remains.
in 2.9 for same date mktime and gmmktime gives different timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270677600
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
in 3.0 for same date mktime and gmmktime gives SAME timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800

#7 @arena
15 years ago

still don't know, i made several attempts to have my plugin code as clean as possible and the error remains.

in 2.9 for same date mktime and gmmktime gives different timestamps

mktime( 0, 0, 0, 4, 8, 2010 ) : 1270677600

gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800

in 3.0 for same date mktime and gmmktime gives SAME timestamps

mktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800

gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800

#8 @ryan
15 years ago

3.0 sets the timezone used by PHP to UTC. If you want local time you have to use current_time(). See [12727].

#9 @ryan
15 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

#10 @arena
15 years ago

Hi ryan

one question :

setcookie and time() ???

shouldn't it be

setcookie and current_time('timestamp')

??

Note: See TracTickets for help on using tickets.