Skip to content

Conversation

@raymondelferink
Copy link
Contributor

In some cases (e.g. slideshare that is private and allows access with secret link) the alternative URL is invalid. This small change makes Embed return the original $info when the second try fails.

@raymondelferink
Copy link
Contributor Author

That travis check is failing because of environment variables not being set for a number of PHP versions.

src/Embed.php Outdated
return self::process(Url::create($info->url), $config, $dispatcher);

//except new result if valid
if($new_info = self::process(Url::create($info->url), $config, $dispatcher, TRUE)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead this, please use a try/catch. Example:

try {
return self::process(Urll:create($info->url), $config, $dispatcher));
} catch (\Exception $e) {
    return $info;
}

@raymondelferink
Copy link
Contributor Author

Great! done that:-)

src/Embed.php Outdated
* @return Adapter
*/
private static function process(Url $url, array $config, DispatcherInterface $dispatcher)
private static function process(Url $url, array $config, DispatcherInterface $dispatcher, $no_exception=FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. You can now remove this argument and the if below.

@raymondelferink
Copy link
Contributor Author

Yes... of course:-) It's done

@oscarotero oscarotero merged commit a442d18 into php-embed:master Jun 27, 2017
@oscarotero
Copy link
Collaborator

thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants