Ticket #2564 (closed defect (bug): fixed)
mysql2date() preg_replace() misinterpretation
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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
comment:1
markjaquith — 6 years ago
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
- Status changed from assigned to closed
- Resolution set to duplicate
Duplicate of #2521.
- Status changed from closed to reopened
- Resolution duplicate 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.
- Status changed from reopened to closed
- Resolution set to fixed
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone changed from 2.1 to 2.0.3
Reopen for inclusion in 2.0.3.
- Status changed from reopened to closed
- Resolution set to fixed
- Status changed from closed to reopened
- Resolution fixed 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".
comment:10
ryan — 6 years ago
See #2774.
comment:11
foolswisdom — 5 years ago
- Status changed from reopened to closed
- Resolution set to fixed
Closing FIXED, based on Ryan's update to see #2774.

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