WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2564 closed defect (bug) (fixed)

mysql2date() preg_replace() misinterpretation

Reported by: tenpura Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 2.0.1
Component: General Keywords: functions.php, mysql2date(), preg_replace(), backreference
Focuses: Cc:

Description

preg_replace() in mysql2date() is using "
1" as backreference and if this is immediately followed by a literal number, misinterpretation occurs.

Suggested Solution:
use "\${1}" instead of "
1"

Change History (12)

#1 @markjaquith
14 years ago

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

+1 This suggestion follows the guidelines set out at http://php.net/preg_replace for backreferences that may be followed by literal numbers.

#2 @ryan
14 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #2521.

#3 @tenpura
14 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Yes, date_i18n() part of that has already been fixed but mysql2date() part remains the same using "
1".
This is the same type of problem as ticket #2521 but regarding different section and unsolved.

#4 @tenpura
14 years ago

I see... it seems like this problem was supposed to be fixed at ticket #2521 but somehow accidentally resolved partially (only date_i18n part was fixed) and closed.
Should I close my ticket and reopen ticket #2521 instead to take care of this issue?

#5 @ryan
14 years ago

Ah, I see. We can fix it in this ticket. Leave it open.

#6 @ryan
14 years ago

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

(In [3654]) Fix backreferences in mysql2date(). Props tenpura. fixes #2564

#7 @ryan
14 years ago

  • Milestone changed from 2.1 to 2.0.3
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for inclusion in 2.0.3.

#8 @ryan
14 years ago

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

(In [3745]) Fix backreferences in mysql2date(). Props tenpura. fixes #2564

#9 @dustball
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

(PHP 4.2.2. MySQL 3.23.51)

On a vanilla install of 2.0.3, the date shows up as: "{1}June 7th, 2006".

Once I reverted this fix in my local install, the date correctly showed as "June 7th, 2006".

#11 @foolswisdom
14 years ago

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

Closing FIXED, based on Ryan's update to see #2774.

#12 @(none)
14 years ago

  • Milestone 2.0.3 deleted

Milestone 2.0.3 deleted

Note: See TracTickets for help on using tickets.