[wp-trac] [WordPress Trac] #11097: shortcode_parse_atts - bug in preg_replace in PHP 4.3.2
WordPress Trac
wp-trac at lists.automattic.com
Sat Nov 7 21:28:01 UTC 2009
#11097: shortcode_parse_atts - bug in preg_replace in PHP 4.3.2
--------------------------+-------------------------------------------------
Reporter: bonaireguy | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: Unassigned
Component: Shortcodes | Version: 2.8.5
Severity: normal | Keywords: shortcodes, php, preg_replace
--------------------------+-------------------------------------------------
On line 230 of wp-include/shortcodes.php is the line:
$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
With $text = ' id="attachment_7" align="aligncenter" width="156"
caption="Fresh Mint Tea in The Netherlands' the above preg_replace
incorrectly returns an empty string in PHP 4.3.2
In PHP 5.1.6 it returns the proper result (namely the same as the input
$text string shown above).
While a PHP bug is not really a WordPress bug, the minimum requirements
for WordPress (see http://codex.wordpress.org/Hosting_WordPress) indicate
that PHP 4.3 is compatible.
Two solutions:
1) Use a different method to replace the UTF-8 space codes the above
preg_replace() call is meant to replace with ASCII spaces.
2) Change the minimum requirements for WordPress (seems overkill).
Note that this problem means that folks with PHP 4.3.2 and WordPress will
not have proper shortcode processing, including captions for photos (which
is I how discovered this).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11097>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list