Search

What I’m trying to do is to remove a certain string from the value of a field that is imported from an XML with the XML Importer plugin.

To do so in the “PHP function” field I've set:

str_replace( ' string to remove' , '', $value );

it works flawlessly… except when there is an apostrophe ( ' ) in the value. In that case the resulting field is empty.

I’ve tried with the htmlspecialchars() function but it didn’t work (or I couldn’t make it work).

Does anyone knows how I could fix this?

Thank you

I solved the problem by placing the function inside the XML Importer Helpers class. The same code works there without a issues.

str_replace( ' string to remove' , '', htmlspecialchars($string, ENT_NOQUOTES, 'UTF-8'));

Does anyone can explain me why?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details