Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not recommended if you are using the libraries other people create. Here are three reasons.</p> <ol> <li>Overloading can break the behaviors of the libraries that don't expect overloading.</li> <li>Your framework can be broken in the environments without overloading.</li> <li>Depending on overloading decreases the prospective users of your framework because of 2</li> </ol> <p>Good example of 1. is miscaliculation of bytesize in HTTP <strong>Content-Length</strong> field by using <strong>strlen</strong>. The cause is that the overloaded <strong>strlen</strong> function does not return the number of <strong>bytes</strong> but number of <strong>characters</strong>. You can see real world issues in <a href="https://github.com/cakephp/cakephp/pull/283" rel="nofollow noreferrer">CakePHP</a> and <a href="http://framework.zend.com/issues/browse/ZF-2098" rel="nofollow noreferrer">Zend_Http_Client</a>.</p> <p><strong>Edit:</strong> deprecating mbstring.func_overload is under consideration in PHP 5.5 or 5.6 (from <a href="http://marc.info/?l=php-internals&amp;m=133548185505478" rel="nofollow noreferrer">mbstring maintainer's mail</a> in 2012 April). So now you <strong>should</strong> avoid mbstring.func_overload.</p> <p>The recommended policy of handling mutibyte characters for various platforms is to use mbstring or intl or iconv directlly. If you really need fallback functions for handling multibyte characters, use <strong>function_exists()</strong>.</p> <p>You can see the cases in <strong>Wordpress</strong> and <strong>MediaWiki</strong>.</p> <ol> <li>WordPress: <a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/compat.php" rel="nofollow noreferrer">wp-includes/compact.php</a></li> <li>MediaWiki: <a href="http://svn.wikimedia.org/doc/classFallback.html" rel="nofollow noreferrer">Fallback Class</a></li> </ol> <p>Some of CMSes like <strong>Drupal</strong> (<a href="http://api.drupal.org/api/drupal/core!includes!unicode.inc/8" rel="nofollow noreferrer">unicocde.inc</a>) introduce mutibyte abstraction layer. </p> <p>I think the abstraction layer is not good idea. The reason is that the number of handling multibyte functions needed in a lot of case is under 10 and umultibyte functions are easy to use and decrease perfomance for switching the handling to mbstring or intl or iconv if these module are installed.</p> <p>The minimum requirement for handling multibyte characters is <strong>mb_substr()</strong> and handling invalid byte sequence. You can see the cases of a fallback function for <strong>mb_substr()</strong> in the above CMSes.<br> I answered about handling invalid byte sequence in the following place: <a href="https://stackoverflow.com/a/13695364/531320">Replacing invalid UTF-8 characters by question marks, mbstring.substitute_character seems</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload