note 100335 modified in function.xml-set-character-data-handler by danbrown

From: Date: Fri, 08 Oct 2010 19:16:14 +0000
Subject: note 100335 modified in function.xml-set-character-data-handler by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173089@lists.php.net to get a copy of this message
For those who are having their character entities eaten by this function (e.g. &amp; &lt; and so forth): You will notice that your callback gets called several times. input: Give me some beans &amp; rice. &#032; call 1: Give me some beans call 2: amp; and rice call 3: #032; There is an obvious workaround. This is not perfect: <?php $text = preg_replace('/^([a-z]+;)/','&\1', $text); $text = preg_replace('/^(#[0-9]+;)/', '&\1', $text); ?> --was-- For those who are having their character entities eaten by this function (e.g. &amp; &lt; and so forth) and are unwilling to wait for the PATHETICALLY OLD BUG http://bugs.php.net/bug.php?id=45996 to get addressed: You will notice that your callback gets called several times. input: Give me some beans &amp; rice. &#032; call 1: Give me some beans call 2: amp; and rice call 3: #032; There is an obvious workaround. This is not perfect: $text = preg_replace('/^([a-z]+;)/','&\1', $text); $text = preg_replace('/^(#[0-9]+;)/', '&\1', $text); http://php.net/manual/en/function.xml-set-character-data-handler.php

« previous php.notes (#173089) next »