Req->Bug #70897 [Opn->Fbk]: htmlspecialchars() add unnecessary characters.

From: Date: Thu, 12 Nov 2015 00:24:56 +0000
Subject: Req->Bug #70897 [Opn->Fbk]: htmlspecialchars() add unnecessary characters.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197184@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70897&edit=1 ID: 70897 Updated by: requinix@php.net Reported by: reject5514 at naver dot com Summary: htmlspecialchars() add unnecessary characters. -Status: Open +Status: Feedback -Type: Feature/Change Request +Type: Bug Package: *General Issues Operating System: Arch Linux ARM 4.1.12 PHP Version: 5.6.15 Block user comment: N Private report: N New Comment: https://3v4l.org/XTslX I'm not seeing it. Are you sure that's the *exact* output? What if you try <?php header('Content-Type: text/plain'); echo htmlspecialchars('b<>"',ENT_QUOTES|ENT_SUBSTITUTE|ENT_HTML5,'UTF-8'); ?> and in a script all by itself? Previous Comments: ------------------------------------------------------------------------ [2015-11-12 00:15:52] reject5514 at naver dot com Description: ------------ --- From manual page: http://www.php.net/function.htmlspecialchars --- htmlspecialchars function add unnessary characters after last encoded character if last character is one of these & < > ' ". Test script: --------------- <?php echo htmlspecialchars('b<>"',ENT_QUOTES|ENT_SUBSTITUTE|ENT_HTML5,'UTF-8'); ?> Expected result: ---------------- b&lt;&gt;&quot; Actual result: -------------- b&lt;&gt;&quot;quot; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70897&edit=1

« previous php.bugs (#197184) next »