File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class OEmbed
1212 use HttpApiTrait;
1313
1414 private static $ providers ;
15+ private array $ defaults = [];
1516
1617 private static function getProviders (): array
1718 {
@@ -70,6 +71,7 @@ private function detectEndpointFromProviders(): ?UriInterface
7071 $ initialUrl = (string ) $ this ->extractor ->getRequest ()->getUri ();
7172
7273 if ($ initialUrl !== $ url && ($ endpoint = $ this ->detectEndpointFromUrl ($ initialUrl ))) {
74+ $ this ->defaults ['url ' ] = $ initialUrl ;
7375 return $ endpoint ;
7476 }
7577
@@ -139,7 +141,7 @@ private static function extractXML(string $xml): array
139141 $ data [$ name ] = $ value ;
140142 }
141143
142- return $ data ;
144+ return $ data ? ( $ data + $ this -> defaults ) : [] ;
143145 } catch (Exception $ exception ) {
144146 return [];
145147 }
@@ -148,7 +150,9 @@ private static function extractXML(string $xml): array
148150 private static function extractJSON (string $ json ): array
149151 {
150152 try {
151- return json_decode ($ json , true ) ?: [];
153+ $ data = json_decode ($ json , true );
154+
155+ return $ data ? ($ data + $ this ->defaults ) : [];
152156 } catch (Exception $ exception ) {
153157 return [];
154158 }
You can’t perform that action at this time.
0 commit comments