@@ -442,43 +442,32 @@ protected function parseUrl($url)
442
442
443
443
$ this ->info = parse_url ($ url );
444
444
445
+ if (isset ($ this ->info ['path ' ])) {
446
+ $ this ->setPath ($ this ->info ['path ' ]);
447
+ }
448
+
445
449
if (empty ($ this ->info ['query ' ])) {
446
450
$ this ->info ['query ' ] = [];
447
- } else {
448
- $ queryString = preg_replace_callback ('/(^|(?<=&))[^=[&]+/ ' , function ($ key ) {
449
- return base64_encode (urldecode ($ key [0 ]));
450
- }, $ this ->info ['query ' ]);
451
-
452
- parse_str ($ queryString , $ query );
453
-
454
- $ this ->info ['query ' ] = $ query ? self ::fixQuery ($ query ) : [];
451
+ return ;
455
452
}
456
453
457
- if (isset ($ this ->info ['path ' ])) {
458
- $ this ->setPath ($ this ->info ['path ' ]);
459
- }
460
- }
454
+ // Fix dots and other characters used in query's variables names
455
+ // https://github.com/oscarotero/Embed/issues/101
456
+ $ queryString = preg_replace_callback ('/(^|(?<=&))[^=[&]+/ ' , function ($ key ) {
457
+ return bin2hex (urldecode ($ key [0 ]));
458
+ }, $ this ->info ['query ' ]);
461
459
462
- /**
463
- * Fix query's key and values.
464
- *
465
- * @param array $query
466
- *
467
- * @return array
468
- */
469
- private static function fixQuery (array $ query )
470
- {
471
- $ fixed = [];
460
+ parse_str ($ queryString , $ query );
472
461
473
- foreach ($ query as $ key => $ value ) {
474
- if (is_array ($ value )) {
475
- $ fixed [base64_decode ($ key )] = self ::fixQuery ($ value );
476
- } else {
477
- $ fixed [base64_decode ($ key )] = urldecode ($ value );
478
- }
462
+ $ this ->info ['query ' ] = (array ) $ query ;
463
+
464
+ foreach ($ this ->info ['query ' ] as $ key => $ value ) {
465
+ $ fixed [hex2bin ($ key )] = $ value ;
479
466
}
480
467
481
- return $ fixed ;
468
+ array_walk_recursive ($ this ->info ['query ' ], function (&$ value ) {
469
+ $ value = urldecode ($ value );
470
+ });
482
471
}
483
472
484
473
/**
0 commit comments