#49564 [Opn->Csd]: mb_detect_encoding() manual page doesn't mention FALSE return value

From: Date: Fri, 13 Nov 2009 22:14:52 +0000
Subject: #49564 [Opn->Csd]: mb_detect_encoding() manual page doesn't mention FALSE return value
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3145@lists.php.net to get a copy of this message
ID: 49564 Updated by: vrana@php.net Reported By: aharvey@php.net -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant -Assigned To: +Assigned To: rquadling New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2009-09-15 16:22:51] svn@php.net Automatic comment from SVN on behalf of rquadling Revision: http://svn.php.net/viewvc/?view=revision&revision=288349 Log: Fix#49564 - Returns false if encoding cannot be determined. ------------------------------------------------------------------------ [2009-09-15 15:13:01] aharvey@php.net Description: ------------ The documentation for mb_detect_encoding() fails to note that FALSE is a possible return value from the function if no encoding can be detected. This can be demonstrated trivially with the reproduce code below, and is obviously intended behaviour, looking at ext/mbstring/mbstring.c and ext/mbstring/libmbfl/mbfl/mbfilter.c. My suggestion would be to replace the Return Values text with the following: "Returns the detected character encoding, or FALSE if the encoding cannot be detected from the given string." Reproduce code: --------------- <?php // On the off chance you want to see this in action, any high-bit // character in the input should return false in strict mode when // ASCII is the only possible encoding. var_dump(mb_detect_encoding("fóò", "ASCII", true)); Expected result: ---------------- bool(false) Actual result: -------------- bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49564&edit=1

« previous php.doc.bugs (#3145) next »