#2774 closed defect (bug) (fixed)
\${1} causing problems for people
Reported by: | markjaquith | Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | normal | Version: | 2.0.2 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
some people are having problems with the \${1} (as opposed to
1) preg_replace() reference format.
http://wordpress.org/support/topic/74496?replies=9
version: 2.0.3
Attachments (3)
Change History (14)
#2
@
19 years ago
2744.diff
What if we backslashed numbers too? I think I counted the slashes correctly but am not positive.
#3
@
19 years ago
Looking at the more recent info in that support thread we are relying on something introduced in PHP 4.3.0 which is newer than some people are using.
http://wordpress.org/about/requirements/ says we need PHP 4.2
#6
@
19 years ago
backslashit() is always used in a PCRE context, at least within WP core, so this would work fine. I wonder if plugins are using backslashit() in other contexts though. Perhaps we should introduce preg_backslashit(). Also, should slash only the digit that occurs at the head of the string? That's the only unsafe one, I believe.
#8
@
19 years ago
I did a grep through a good chunk of wp-plugins.org and the only place backslashit was used was in a multilingual plugin that uses it in the exact same context and so would benefit from this patch. I was not able to co everything from wp-plugins; it hung on some encoding error part way through trying to co google-sitemap-generator.
2774b.diff
- Only replace 1st number.
- Fix mysql3date and date_i18n
But making a new function is fine with me too:
2744c-preg.diff
- All of the above in a new function preg_backslashit.
Weird. PHP bug? Reverting back will break some i18n users.