fixes #4916, i18n quoted strings. fixes #4968, quoted strings in cache

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7243 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-06-23 00:27:33 +00:00
parent 67f55ba53e
commit 352b121220
4 changed files with 64 additions and 43 deletions

View file

@ -171,8 +171,9 @@ class FileEngine extends CacheEngine {
if ($data !== '' && !empty($this->settings['serialize'])) {
if (substr(PHP_OS, 0, 3) == "WIN") {
$data = str_replace('\\\\\\\\', '\\', $data);
}
$data = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $data);
}
$data = unserialize($data);
}
$this->__File->close();

View file

@ -331,5 +331,13 @@ class FileEngineTest extends CakeTestCase {
$this->assertEqual($expected, $data);
}
function testWriteQuotedString() {
Cache::engine('File', array('path' => TMP . 'tests'));
Cache::write('App.doubleQuoteTest', '"this is a quoted string"');
$this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"');
Cache::write('App.singleQuoteTest', "'this is a quoted string'");
$this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'");
}
}
?>

View file

@ -1876,6 +1876,16 @@ EOD;
$result = __('No Translation needed', true);
$this->assertEqual($result, 'No Translation needed');
}
/**
* testPoQuotedString method
*
* @access public
* @return void
*/
function testPoQuotedString () {
$expected = 'this is a "quoted string" (translated)';
$this->assertEqual(__('this is a "quoted string"', true), $expected);
}
/**
* Singular method
*

View file

@ -69,3 +69,5 @@ msgstr[0] "v \n"
msgstr[1] "vs \n"
"second line"
msgid "this is a \"quoted string\""
msgstr "this is a \"quoted string\" (translated)"