Search code examples
phpescapingpyrocmsstrip-tags

PHP truncating string when using strip_tags


I have this stored in my MySQL InnoDB UTF8 database:

<p>At 5'1" (155cm) in length, this "Baby" grand piano was introduced in the 1930's and features the powerful and rich tone of a much larger piano. Small enough to fit nicely into almost any room, this piano is handcrafted using the same materials and techniques that go into making our concert grand pianos.</p>

When I echo strip_tags($string), PHP returns this:

Introduced 5\'1\

And that's it. I found a similar reported bug here (affected having slashes, not single/double quotes) but it was resolved. I'm using PHP 5.3.6.

Any idea how I can resolve this without needing to use preg_replace?


Solution

  • This was an issue with the Lex parser that PyroCMS uses. The fix can be found here:

    https://github.com/happyninjas/lex/commit/ff9aa30554fce47a8bfb6dc7c94143afc2fd8f93

    I also committed the change to PyroCMS. Hopefully it gets implemented for the next release.