mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
cb6a38abaf
commit
94d1899fd4
3 changed files with 21 additions and 1 deletions
|
@ -1260,6 +1260,7 @@
|
||||||
}
|
}
|
||||||
$calledFrom = debug_backtrace();
|
$calledFrom = debug_backtrace();
|
||||||
$dir = dirname($calledFrom[0]['file']);
|
$dir = dirname($calledFrom[0]['file']);
|
||||||
|
unset($calledFrom);
|
||||||
|
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
echo I18n::translate($singular, null, null, 5, null, $dir);
|
echo I18n::translate($singular, null, null, 5, null, $dir);
|
||||||
|
@ -1283,6 +1284,7 @@
|
||||||
}
|
}
|
||||||
$calledFrom = debug_backtrace();
|
$calledFrom = debug_backtrace();
|
||||||
$dir = dirname($calledFrom[0]['file']);
|
$dir = dirname($calledFrom[0]['file']);
|
||||||
|
unset($calledFrom);
|
||||||
|
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
echo I18n::translate($singular, $plural, null, 5, $count, $dir);
|
echo I18n::translate($singular, $plural, null, 5, $count, $dir);
|
||||||
|
@ -1426,6 +1428,7 @@
|
||||||
}
|
}
|
||||||
$calledFrom = debug_backtrace();
|
$calledFrom = debug_backtrace();
|
||||||
$dir = dirname($calledFrom[0]['file']);
|
$dir = dirname($calledFrom[0]['file']);
|
||||||
|
unset($calledFrom);
|
||||||
|
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
echo I18n::translate($msg, null, null, $category, null, $dir);
|
echo I18n::translate($msg, null, null, $category, null, $dir);
|
||||||
|
|
|
@ -199,7 +199,7 @@ class Sanitize{
|
||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $key => $val) {
|
foreach ($data as $key => $val) {
|
||||||
$data[$key] = Sanitize::clean($val, $options['connection']);
|
$data[$key] = Sanitize::clean($val, $options);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -77,6 +77,23 @@ class SanitizeTest extends UnitTestCase {
|
||||||
$expected = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
$expected = 'test & "quote" \'other\' ;.$ symbol.' . "\r" . 'another line';
|
||||||
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'carriage' => false));
|
$result = Sanitize::clean($string, array('encode' => false, 'escape' => false, 'carriage' => false));
|
||||||
$this->assertEqual($result, $expected);
|
$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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue