From 9ace567e8e29a790b6dd8be710a721bf3ccf2a84 Mon Sep 17 00:00:00 2001 From: phpnut Date: Tue, 27 Mar 2007 02:59:22 +0000 Subject: [PATCH] Adding test for Validate::ip(). Fixed Ticket #2298. Fixed issue with I10n class not setting default language git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4689 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/components/email.php | 4 ++++ cake/libs/l10n.php | 4 ++-- cake/tests/cases/libs/validation.test.php | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index bc51ce3f1..8b64c4848 100644 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -235,6 +235,10 @@ class EmailComponent extends Object{ $this->delivery = 'debug'; } $__method = '__'.$this->delivery; + + if(low($this->charset) === 'utf-8') { + $this->subject = utf8_decode($this->subject); + } return $this->$__method(); } /** diff --git a/cake/libs/l10n.php b/cake/libs/l10n.php index cdda4636d..6bfc92c69 100644 --- a/cake/libs/l10n.php +++ b/cake/libs/l10n.php @@ -374,7 +374,7 @@ class L10n extends Object { } if($this->default) { - $this->languagePath = array(2 => $this->__l10nCatalog[$this->default]['localeFallback']); + $this->languagePath[2] = $this->__l10nCatalog[$this->default]['localeFallback']; } $this->found = true; Configure::write('Config.language', $this->lang); @@ -398,7 +398,7 @@ class L10n extends Object { $this->charset = $this->__l10nCatalog[$langKey]['charset']; if($this->default) { - $this->languagePath = array(2 => $this->__l10nCatalog[$this->default]['localeFallback']); + $this->languagePath[2] = $this->__l10nCatalog[$this->default]['localeFallback']; } $this->found = true; Configure::write('Config.language', $this->lang); diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 0d98bb8b4..f5ada21a3 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -1216,6 +1216,7 @@ class ValidationTestCase extends UnitTestCase { function testIp() { $validation = new Validation(); $this->assertTrue($validation->ip('0.0.0.0')); + $this->assertTrue($validation->ip('192.168.1.156')); $this->assertTrue($validation->ip('255.255.255.255')); $this->assertFalse($validation->ip('127.0.0')); $this->assertFalse($validation->ip('127.0.0.a'));