Skip to content

Commit bb83274

Browse files
committed
Merge branch '2.8'
Conflicts: CHANGELOG-2.3.md CHANGELOG-2.7.md composer.json src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Bundle/SecurityBundle/composer.json src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php src/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php src/Symfony/Component/Console/composer.json src/Symfony/Component/DomCrawler/composer.json src/Symfony/Component/Form/Tests/FormRegistryTest.php src/Symfony/Component/Form/composer.json src/Symfony/Component/HttpFoundation/composer.json src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php src/Symfony/Component/Intl/composer.json src/Symfony/Component/Ldap/composer.json src/Symfony/Component/Security/Core/composer.json src/Symfony/Component/Security/Csrf/composer.json src/Symfony/Component/Security/Http/composer.json src/Symfony/Component/Security/composer.json src/Symfony/Component/Serializer/Encoder/JsonEncoder.php src/Symfony/Component/Serializer/composer.json src/Symfony/Component/Templating/PhpEngine.php src/Symfony/Component/Translation/composer.json src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php src/Symfony/Component/VarDumper/composer.json
2 parents e7c5fcb + 89fe69d commit bb83274

File tree

6 files changed

+5
-28
lines changed

6 files changed

+5
-28
lines changed

DataCollector/TranslationDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function sanitizeString($string, $length = 80)
137137
{
138138
$string = trim(preg_replace('/\s+/', ' ', $string));
139139

140-
if (function_exists('mb_strlen') && false !== $encoding = mb_detect_encoding($string)) {
140+
if (false !== $encoding = mb_detect_encoding($string, null, true)) {
141141
if (mb_strlen($string, $encoding) > $length) {
142142
return mb_substr($string, 0, $length - 3, $encoding).'...';
143143
}

Loader/CsvFileLoader.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,8 @@ protected function loadResource($resource)
4141
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
4242

4343
foreach ($file as $data) {
44-
if (substr($data[0], 0, 1) === '#') {
45-
continue;
46-
}
47-
48-
if (!isset($data[1])) {
49-
continue;
50-
}
51-
52-
if (count($data) == 2) {
44+
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) {
5345
$messages[$data[0]] = $data[1];
54-
} else {
55-
continue;
5646
}
5747
}
5848

Loader/XliffFileLoader.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,7 @@ private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, $
153153
private function utf8ToCharset($content, $encoding = null)
154154
{
155155
if ('UTF-8' !== $encoding && !empty($encoding)) {
156-
if (function_exists('mb_convert_encoding')) {
157-
return mb_convert_encoding($content, $encoding, 'UTF-8');
158-
}
159-
160-
if (function_exists('iconv')) {
161-
return iconv('UTF-8', $encoding, $content);
162-
}
163-
164-
throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).');
156+
return mb_convert_encoding($content, $encoding, 'UTF-8');
165157
}
166158

167159
return $content;

Tests/Dumper/IcuResFileDumperTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
1818
{
19-
/**
20-
* @requires extension mbstring
21-
*/
2219
public function testFormatCatalogue()
2320
{
2421
$catalogue = new MessageCatalogue('en');

Tests/Loader/XliffFileLoaderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ public function testIncompleteResource()
5959
$this->assertEquals(array('foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
6060
}
6161

62-
/**
63-
* @requires extension mbstring
64-
*/
6562
public function testEncoding()
6663
{
6764
$loader = new XliffFileLoader();

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.5.9"
19+
"php": ">=5.5.9",
20+
"symfony/polyfill-mbstring": "~1.0"
2021
},
2122
"require-dev": {
2223
"symfony/config": "~2.8|~3.0",

0 commit comments

Comments
 (0)