preg_replace "\v" not working
-
A simple dash in the text was causing the text for an entry to not be displayed. I commented out lines 48 and 49 and the problem went away. This is the string I tried to enter into the WYSIWYG for the timeline custom post type.
In my day, there was only one show in town — it was called “Stare at the sun!” … That’s right!
$text = apply_filters('the_content', $post->post_content); // $text = preg_replace('/\v+|\\\[rn]/','',$text); // $text = $this->undoTexturize($text);
\v actually replaced instances of the character “v” and not vertical whitespace characters as intended. I think there is an issue in PHP where \R and \v don’t work as expected when run in classes. Rethink the \v. I have php 5.3 and \v was introduced in 5.2, so my version of PHP is not the issue.
Also undoTexturize was causing non-utf8 characters to show up as that annoying black diamond on the front end. Rethink that filtering process. json_encode takes care of a lot of stuff directly. I think you’re overthinking the filtering.
- The topic ‘preg_replace "\v" not working’ is closed to new replies.