#40405 [Opn->Bgs]: htmlentities example is incorrect.

From: Date: Fri, 09 Feb 2007 10:57:54 +0000
Subject: #40405 [Opn->Bgs]: htmlentities example is incorrect.
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969375394@lists.php.net to get a copy of this message
ID: 40405 Updated by: rquadling@php.net Reported By: ar3121 at att dot com -Status: Open +Status: Bogus Bug Type: Documentation problem PHP Version: Irrelevant New Comment: The example is correct. 09/02/2007 11:00:05 C:\>php -n <?php $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str); // Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str, ENT_QUOTES); ?> ^Z A 'quote' is &lt;b&gt;bold&lt;/b&gt;A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt; Previous Comments: ------------------------------------------------------------------------ [2007-02-08 17:12:17] ar3121 at att dot com Description: ------------ On the htmlentities function documentation page: http://us2.php.net/htmlentities Example 2262 is incorrect. The function call with and without ENT_QUOTES produces different results, but the documentation says they're the same. Expected result: ---------------- <?php $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str); // Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str, ENT_QUOTES); ?> Actual result: -------------- <?php $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str); // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str, ENT_QUOTES); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40405&edit=1

« previous php.doc (#969375394) next »