Fixes #3441, Sanitize::clean() doesn't pass options when doing recursion on array data

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5872 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-10-22 23:34:20 +00:00
parent cb6a38abaf
commit 94d1899fd4
3 changed files with 21 additions and 1 deletions

View file

@ -1260,6 +1260,7 @@
}
$calledFrom = debug_backtrace();
$dir = dirname($calledFrom[0]['file']);
unset($calledFrom);
if ($return === false) {
echo I18n::translate($singular, null, null, 5, null, $dir);
@ -1283,6 +1284,7 @@
}
$calledFrom = debug_backtrace();
$dir = dirname($calledFrom[0]['file']);
unset($calledFrom);
if ($return === false) {
echo I18n::translate($singular, $plural, null, 5, $count, $dir);
@ -1426,6 +1428,7 @@
}
$calledFrom = debug_backtrace();
$dir = dirname($calledFrom[0]['file']);
unset($calledFrom);
if ($return === false) {
echo I18n::translate($msg, null, null, $category, null, $dir);

View file

@ -199,7 +199,7 @@ class Sanitize{
if (is_array($data)) {
foreach ($data as $key => $val) {
$data[$key] = Sanitize::clean($val, $options['connection']);
$data[$key] = Sanitize::clean($val, $options);
}
return $data;
} else {

View file

@ -77,6 +77,23 @@ class SanitizeTest extends UnitTestCase {
$expected = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'carriage' => false));
$this->assertEqual($result, $expected);
$array = array(array('test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line'));
$expected = array(array('test & "quote" 'other' ;.$ symbol.another line'));
$result = Sanitize::clean($array);
$this->assertEqual($result, $expected);
$array = array(array('test & "quote" \'other\' ;.$ \\$ symbol.' . "\r" . 'another line'));
$expected = array(array('test & "quote" \'other\' ;.$ $ symbol.another line'));
$result = Sanitize::clean($array, array('encode' => false, 'escape' => false));
$this->assertEqual($result, $expected);
}
}
?>