update v1.0.7.9 R.C.

This is a Release Candidate. We are still testing.
This commit is contained in:
Sujit Prasad
2016-08-03 20:04:36 +05:30
parent 8b6b924d09
commit ffa56a43cb
3830 changed files with 181529 additions and 495353 deletions

View File

@@ -31,7 +31,8 @@
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
"phpunit/phpunit": "~4.4",
"ext-mbstring": "*"
},
"autoload": {
"classmap": [
@@ -40,7 +41,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.3.x-dev"
}
}
}

View File

@@ -89,11 +89,10 @@ class Exporter
* Exports a value into a single-line string
*
* The output of this method is similar to the output of
* SebastianBergmann\Exporter\Exporter::export. This method guarantees
* thought that the result contains now newlines.
* SebastianBergmann\Exporter\Exporter::export().
*
* Newlines are replaced by the visible string '\n'. Contents of arrays
* and objects (if any) are replaced by '...'.
* Newlines are replaced by the visible string '\n'.
* Contents of arrays and objects (if any) are replaced by '...'.
*
* @param mixed $value
* @return string
@@ -104,8 +103,14 @@ class Exporter
if (is_string($value)) {
$string = $this->export($value);
if (strlen($string) > 40) {
$string = substr($string, 0, 30) . '...' . substr($string, -7);
if (function_exists('mb_strlen')) {
if (mb_strlen($string) > 40) {
$string = mb_substr($string, 0, 30) . '...' . mb_substr($string, -7);
}
} else {
if (strlen($string) > 40) {
$string = substr($string, 0, 30) . '...' . substr($string, -7);
}
}
return str_replace("\n", '\n', $string);
@@ -225,7 +230,7 @@ class Exporter
if (is_string($value)) {
// Match for most non printable chars somewhat taking multibyte chars into account
if (preg_match('/[^\x09-\x0d\x20-\xff]/', $value)) {
if (preg_match('/[^\x09-\x0d\x1b\x20-\xff]/', $value)) {
return 'Binary String: 0x' . bin2hex($value);
}

View File

@@ -300,6 +300,31 @@ EOF;
);
}
/**
* @requires extension mbstring
*/
public function testShortenedExportForMultibyteCharacters()
{
$oldMbLanguage = mb_language();
mb_language('Japanese');
$oldMbInternalEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');
try {
$this->assertSame(
"'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくや...しゑひもせす'",
$this->trimNewline($this->exporter->shortenedExport('いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす'))
);
} catch (\Exception $e) {
mb_internal_encoding($oldMbInternalEncoding);
mb_language($oldMbLanguage);
throw $e;
}
mb_internal_encoding($oldMbInternalEncoding);
mb_language($oldMbLanguage);
}
public function provideNonBinaryMultibyteStrings()
{
return array(