Skip to content

Commit 09486a8

Browse files
committed
Removes unnecessary calls to mb_strtolower
1 parent 773cc01 commit 09486a8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

library/Pdp/Parser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function getPublicSuffix($host)
128128
return null;
129129
}
130130

131-
$host = mb_strtolower($host, 'UTF-8');
132131
$parts = array_reverse(explode('.', $host));
133132
$publicSuffix = array();
134133
$publicSuffixList = $this->publicSuffixList;
@@ -217,7 +216,6 @@ public function getRegisterableDomain($host)
217216
*/
218217
public function getSubdomain($host)
219218
{
220-
$host = mb_strtolower($host, 'UTF-8');
221219
$registerableDomain = $this->getRegisterableDomain($host);
222220

223221
if ($registerableDomain === null || $host == $registerableDomain) {
@@ -238,7 +236,7 @@ public function getSubdomain($host)
238236
*
239237
* @return array
240238
*/
241-
public function mbParseUrl($url)
239+
protected function mbParseUrl($url)
242240
{
243241
$enc_url = preg_replace_callback(
244242
'%[^:/@?&=#]+%usD',

tests/library/Pdp/ParserTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ protected function tearDown()
2323

2424
/**
2525
* @covers Pdp\Parser::parseUrl()
26+
* @covers Pdp\Parser::mbParseUrl()
2627
*/
2728
public function testParseBadUrlThrowsInvalidArgumentException()
2829
{
@@ -108,7 +109,7 @@ public function parseDataProvider()
108109
// url, public suffix, registerable domain, subdomain, host part
109110
return array(
110111
array('http://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'),
111-
array('example.com', 'com', 'example.com', null, 'example.com'),
112+
array('example.COM', 'com', 'example.com', null, 'example.com'),
112113
array('giant.yyyy', 'yyyy', 'giant.yyyy', null, 'giant.yyyy'),
113114
array('cea-law.co.il', 'co.il', 'cea-law.co.il', null, 'cea-law.co.il'),
114115
array('http://edition.cnn.com/WORLD/', 'com', 'cnn.com', 'edition', 'edition.cnn.com'),

0 commit comments

Comments
 (0)