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

From: Date: Fri, 09 Feb 2007 15:05:54 +0000
Subject: #40405 [Bgs->Opn]: htmlentities example is incorrect.
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969375398@lists.php.net to get a copy of this message
ID: 40405 User updated by: ar3121 at att dot com Reported By: ar3121 at att dot com -Status: Bogus +Status: Open Bug Type: Documentation problem PHP Version: Irrelevant New Comment: Look closer... the actual html you just posted does not match the example. Maybe it would help if you focused on just the second half of the example: <?php $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt; echo htmlentities($str, ENT_QUOTES); ?> Previous Comments: ------------------------------------------------------------------------ [2007-02-09 11:00:18] rquadling@php.net If you run the code through a browser (I'm using FF on WinXP), then the screen shows ... A 'quote' is <b>bold</b>A 'quote' is <b>bold</b> But if you look at the actual HTML ... A 'quote' is &lt;b&gt;bold&lt;/b&gt;A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt; Which matches the example. ------------------------------------------------------------------------ [2007-02-09 10:57:54] rquadling@php.net 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; ------------------------------------------------------------------------ [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 (#969375398) next »