Ticket #2564 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

mysql2date() preg_replace() misinterpretation

Reported by: tenpura Assigned to: markjaquith
Priority: normal Milestone:
Component: General Version: 2.0.1
Severity: normal Keywords: functions.php, mysql2date(), preg_replace(), backreference
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

03/14/06 05:51:28 changed by markjaquith

  • 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.

03/14/06 06:05:35 changed by ryan

  • status changed from assigned to closed.
  • resolution set to duplicate.

Duplicate of #2521.

03/14/06 13:59:54 changed by tenpura

  • status changed from closed to reopened.
  • resolution deleted.

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.

03/14/06 15:42:20 changed by tenpura

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?

03/14/06 19:24:18 changed by ryan

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

03/21/06 04:19:55 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

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

04/22/06 00:20:33 changed by ryan

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 2.1 to 2.0.3.

Reopen for inclusion in 2.0.3.

04/22/06 00:22:31 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

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

06/08/06 02:32:55 changed by dustball

  • status changed from closed to reopened.
  • resolution deleted.

(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".

06/08/06 02:45:29 changed by ryan

See #2774.

09/21/06 01:12:51 changed by foolswisdom

  • status changed from reopened to closed.
  • resolution set to fixed.

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

11/30/06 19:41:50 changed by

  • milestone deleted.

Milestone 2.0.3 deleted