From 94d1899fd4bd0ab66ee3343b0e3c736f712a432e Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 22 Oct 2007 23:34:20 +0000 Subject: [PATCH] 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 --- cake/basics.php | 3 +++ cake/libs/sanitize.php | 2 +- cake/tests/cases/libs/sanitize.test.php | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cake/basics.php b/cake/basics.php index e3bdd2185..988b8088c 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -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); diff --git a/cake/libs/sanitize.php b/cake/libs/sanitize.php index 2e99c1824..3e35b324a 100644 --- a/cake/libs/sanitize.php +++ b/cake/libs/sanitize.php @@ -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 { diff --git a/cake/tests/cases/libs/sanitize.test.php b/cake/tests/cases/libs/sanitize.test.php index da1e492bd..ade669e56 100644 --- a/cake/tests/cases/libs/sanitize.test.php +++ b/cake/tests/cases/libs/sanitize.test.php @@ -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); + + + + + + + } } ?>