Skip to content

Commit 0e052da

Browse files
Rely on iconv and symfony/polyfill-*
1 parent aa2673b commit 0e052da

File tree

91 files changed

+159
-767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+159
-767
lines changed

composer.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
"twig/twig": "~1.20|~2.0",
2222
"psr/log": "~1.0",
2323
"symfony/security-acl": "~2.7",
24-
"paragonie/random_compat": "~1.0"
24+
"symfony/polyfill-intl-icu": "~1.0",
25+
"symfony/polyfill-mbstring": "~1.0",
26+
"symfony/polyfill-php54": "~1.0",
27+
"symfony/polyfill-php55": "~1.0",
28+
"symfony/polyfill-php56": "~1.0",
29+
"symfony/polyfill-php70": "~1.0",
30+
"symfony/polyfill-util": "~1.0"
2531
},
2632
"replace": {
2733
"symfony/asset": "self.version",
@@ -77,7 +83,6 @@
7783
"doctrine/orm": "~2.4,>=2.4.5",
7884
"doctrine/doctrine-bundle": "~1.2",
7985
"monolog/monolog": "~1.11",
80-
"ircmaxell/password-compat": "~1.0",
8186
"ocramius/proxy-manager": "~0.4|~1.0",
8287
"egulias/email-validator": "~1.2",
8388
"phpdocumentor/reflection": "^1.0.7"
@@ -96,10 +101,8 @@
96101
"Symfony\\Component\\": "src/Symfony/Component/"
97102
},
98103
"classmap": [
99-
"src/Symfony/Component/HttpFoundation/Resources/stubs",
100104
"src/Symfony/Component/Intl/Resources/stubs"
101-
],
102-
"files": [ "src/Symfony/Component/Intl/Resources/stubs/functions.php" ]
105+
]
103106
},
104107
"minimum-stability": "dev",
105108
"extra": {

src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,9 @@ private function normalizeParams(array $params)
9999
}
100100

101101
// detect if the too long string must be shorten
102-
if (function_exists('mb_strlen')) {
103-
if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], 'UTF-8')) {
104-
$params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]';
105-
continue;
106-
}
107-
} else {
108-
if (self::MAX_STRING_LENGTH < strlen($params[$index])) {
109-
$params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]';
110-
continue;
111-
}
102+
if (self::MAX_STRING_LENGTH < iconv_strlen($params[$index], 'UTF-8')) {
103+
$params[$index] = iconv_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]';
104+
continue;
112105
}
113106
}
114107

src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ public function testLogLongString()
132132
));
133133
}
134134

135-
/**
136-
* @requires extension mbstring
137-
*/
138135
public function testLogUTF8LongString()
139136
{
140137
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
@@ -160,7 +157,7 @@ public function testLogUTF8LongString()
160157
$dbalLogger
161158
->expects($this->once())
162159
->method('log')
163-
->with('SQL', array('short' => $shortString, 'long' => mb_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, mb_detect_encoding($longString)).' [...]'))
160+
->with('SQL', array('short' => $shortString, 'long' => iconv_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]'))
164161
;
165162

166163
$dbalLogger->startQuery('SQL', array(

src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener
2424
private $skippedFile = false;
2525
private $wasSkipped = array();
2626
private $isSkipped = array();
27-
private $testsStack = array();
2827

2928
public function __destruct()
3029
{

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/finder": "~2.3|~3.0.0",
2525
"symfony/form": "~2.8",
2626
"symfony/http-kernel": "~2.8|~3.0.0",
27-
"symfony/intl": "~2.3|~3.0.0",
27+
"symfony/polyfill-intl-icu": "~1.0",
2828
"symfony/routing": "~2.2|~3.0.0",
2929
"symfony/templating": "~2.1|~3.0.0",
3030
"symfony/translation": "~2.7|~3.0.0",

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private function sanitizeString($string, $length = 40)
240240
{
241241
$string = trim(preg_replace('/\s+/', ' ', $string));
242242

243-
if (function_exists('mb_strlen') && false !== $encoding = mb_detect_encoding($string)) {
243+
if (false !== $encoding = mb_detect_encoding($string, null, true)) {
244244
if (mb_strlen($string, $encoding) > $length) {
245245
return mb_substr($string, 0, $length - 3, $encoding).'...';
246246
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"symfony/event-dispatcher": "~2.8|~3.0.0",
2525
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4|~3.0.0",
2626
"symfony/http-kernel": "~2.8",
27+
"symfony/polyfill-mbstring": "~1.0",
2728
"symfony/filesystem": "~2.3|~3.0.0",
2829
"symfony/routing": "~2.8|~3.0.0",
2930
"symfony/security-core": "~2.6|~3.0.0",
@@ -40,7 +41,7 @@
4041
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
4142
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
4243
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
43-
"symfony/intl": "~2.3|~3.0.0",
44+
"symfony/polyfill-intl-icu": "~1.0",
4445
"symfony/security": "~2.6|~3.0.0",
4546
"symfony/form": "~2.8",
4647
"symfony/expression-language": "~2.6|~3.0.0",

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
},
2424
"require-dev": {
2525
"symfony/browser-kit": "~2.4|~3.0.0",
26-
"symfony/config": "~2.8|~3.0.0",
2726
"symfony/console": "~2.7|~3.0.0",
2827
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
2928
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
@@ -37,8 +36,7 @@
3736
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
3837
"symfony/expression-language": "~2.6|~3.0.0",
3938
"doctrine/doctrine-bundle": "~1.2",
40-
"twig/twig": "~1.20|~2.0",
41-
"ircmaxell/password-compat": "~1.0"
39+
"twig/twig": "~1.20|~2.0"
4240
},
4341
"autoload": {
4442
"psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" }

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,11 +1077,7 @@ public function setDefaultCommand($commandName)
10771077

10781078
private function stringWidth($string)
10791079
{
1080-
if (!function_exists('mb_strwidth')) {
1081-
return strlen($string);
1082-
}
1083-
1084-
if (false === $encoding = mb_detect_encoding($string)) {
1080+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
10851081
return strlen($string);
10861082
}
10871083

@@ -1094,11 +1090,7 @@ private function splitStringByWidth($string, $width)
10941090
// additionally, array_slice() is not enough as some character has doubled width.
10951091
// we need a function to split string not by character count but by string width
10961092

1097-
if (!function_exists('mb_strwidth')) {
1098-
return str_split($string, $width);
1099-
}
1100-
1101-
if (false === $encoding = mb_detect_encoding($string)) {
1093+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
11021094
return str_split($string, $width);
11031095
}
11041096

src/Symfony/Component/Console/Helper/Helper.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ public function getHelperSet()
5151
*/
5252
public static function strlen($string)
5353
{
54-
if (!function_exists('mb_strwidth')) {
55-
return strlen($string);
56-
}
57-
58-
if (false === $encoding = mb_detect_encoding($string)) {
54+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
5955
return strlen($string);
6056
}
6157

0 commit comments

Comments
 (0)