mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fixes #4571 Helper::clean() returns null if passed empty array or string.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6759 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
0628b24760
commit
3263c0bc81
2 changed files with 15 additions and 0 deletions
|
@ -213,6 +213,9 @@ class Helper extends Overloadable {
|
|||
*/
|
||||
function clean($output) {
|
||||
$this->__reset();
|
||||
if (empty($output)) {
|
||||
return null;
|
||||
}
|
||||
if (is_array($output)) {
|
||||
foreach ($output as $key => $value) {
|
||||
$return[$key] = $this->clean($value);
|
||||
|
|
|
@ -337,6 +337,18 @@ class HelperTest extends UnitTestCase {
|
|||
$this->assertEqual($result, 100);
|
||||
}
|
||||
|
||||
function testClean() {
|
||||
$result = $this->Helper->clean(array());
|
||||
$this->assertEqual($result, null);
|
||||
|
||||
$result = $this->Helper->clean(array('<script>with something</script>', '<applet>something else</applet>'));
|
||||
$this->assertEqual($result, array('with something', 'something else'));
|
||||
|
||||
$result = $this->Helper->clean('<script>with something</script>');
|
||||
$this->assertEqual($result, 'with something');
|
||||
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->Helper, $this->View);
|
||||
ClassRegistry::flush();
|
||||
|
|
Loading…
Reference in a new issue