[wp-trac] [WordPress Trac] #34711: date_i18n bug with format M-t
WordPress Trac
noreply at wordpress.org
Tue Nov 17 09:51:29 UTC 2015
#34711: date_i18n bug with format M-t
--------------------------+-----------------------------
Reporter: liedekef | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.3.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
If the format "M-t" is used, the preg_replace used in date_i18n:
{{{
$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit(
$datemonth_abbrev ), $dateformatstring );
}}}
is not matching the first character (being "M" in this case), resulting in
the month abbrev not being replaced (the other regex's are similar).
A small php script that reproduces this (the format string starts with "M"
and the second time with " ", the regex is taken from date_i18n):
{{{#!php
<?php
$dateformatstring="M-t";
$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . "test",
$dateformatstring );
print "WRONG result: ".$dateformatstring."\n";
$dateformatstring=" M-t";
$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . "test",
$dateformatstring );
print "Correct result: ".$dateformatstring."\n";
?>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34711>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list