Skip to content

Commit 9e989ad

Browse files
committed
replaced bin2hex for base64_encode #101
1 parent bb03284 commit 9e989ad

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Url.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ protected function parseUrl($url)
444444

445445
if (isset($this->info['query'])) {
446446
$queryString = preg_replace_callback('/(^|(?<=&))[^=[&]+/', function ($key) {
447-
return bin2hex(urldecode($key[0]));
447+
return base64_encode(urldecode($key[0]));
448448
}, $this->info['query']);
449449

450450
parse_str($queryString, $query);
@@ -470,9 +470,9 @@ private static function fixQuery(array $query)
470470

471471
foreach ($query as $key => $value) {
472472
if (is_array($value)) {
473-
$fixed[hex2bin($key)] = self::fixQuery($value);
473+
$fixed[base64_decode($key)] = self::fixQuery($value);
474474
} else {
475-
$fixed[hex2bin($key)] = urldecode($value);
475+
$fixed[base64_decode($key)] = urldecode($value);
476476
}
477477
}
478478

tests/MovimTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public function testOne()
88
'https://nl.movim.eu/?node/blabla.movim.eu/random/1fb06a3cc05c4490bf659c227b39a9aa',
99
[
1010
'title' => 'Paris Attacks, cat not giving a fuck',
11+
'url' => 'https://nl.movim.eu/?node/blabla.movim.eu/random/1fb06a3cc05c4490bf659c227b39a9aa',
1112
'description' => 'Can you find the cat?',
1213
'image' => 'http://hugelolcdn.com/i700/361973.jpg',
1314
]

0 commit comments

Comments
 (0)