Confusing html_entity_decode() behavior

Hi all,

I’m playing around with Zend Framework 1.10 and populating forms.

The value I see in my DB table name field is ‘Name & Name’ due to setting a ZF filter of htmlentities to filter content before inserting to the DB.

However, when I populate a text field with the info, it displays as ‘Name & Name’. Any idea where that second amp; is coming from?

I tried using html_entity_decode() on it, but that only removes the amp; part and leaves the &.

Hope that makes sense. Thanks for any help.

Ah, alrighty then. I ask, what good is a book that gives bad information? :rolleyes:


That is happening because you are incorrectly setting htmlentities both on inserting to the database and extracting from the database. It should only be used when extracting from the database to write to a web page and should not be used on input to the database.