#49564 [NEW]: mb_detect_encoding() manual page doesn't mention FALSE return value

From: Date: Tue, 15 Sep 2009 15:13:01 +0000
Subject: #49564 [NEW]: mb_detect_encoding() manual page doesn't mention FALSE return value
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2776@lists.php.net to get a copy of this message
From: aharvey@php.net Operating system: Irrelevant PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: mb_detect_encoding() manual page doesn't mention FALSE return value 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 bug report at http://bugs.php.net/?id=49564&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49564&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49564&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49564&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49564&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49564&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49564&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49564&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49564&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49564&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49564&r=support Expected behavior: http://bugs.php.net/fix.php?id=49564&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49564&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49564&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49564&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49564&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49564&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49564&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49564&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49564&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49564&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49564&r=mysqlcfg

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