Przeglądaj źródła

merged branch schmittjoh/mbFix (PR #2194)

Commits
-------

8e2cbe6 fixes usage of mb_*

Discussion
----------

Fixes usage of mb_strlen

---------------------------------------------------------------------------

by Seldaek at 2011/09/16 05:33:45 -0700

This will fail if the mbstring ext isn't enabled, you should still test for the mb_ function first.
Fabien Potencier 13 lat temu
rodzic
commit
607337b022
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      src/Symfony/Component/Console/Application.php

+ 5 - 1
src/Symfony/Component/Console/Application.php

@@ -720,7 +720,11 @@ class Application
     {
     {
         $strlen = function ($string)
         $strlen = function ($string)
         {
         {
-            return function_exists('mb_strlen') ? mb_strlen($string, mb_detect_encoding($string)) : strlen($string);
+            if (false === $encoding = mb_detect_encoding($string)) {
+                return strlen($string);
+            }
+
+            return function_exists('mb_strlen') ? mb_strlen($string, $encoding) : strlen($string);
         };
         };
 
 
         do {
         do {