anythink-wx / php-oembed

Automatically exported from code.google.com/p/php-oembed
0 stars 0 forks source link

Script crashes when attempting to call URL with embedding disabled. #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enter a URL with embedding disabled
(http://www.youtube.com/watch?v=yh5ZS5N51ug)
2. Script crashes in YouTubeProvider.class.php when trying to set
$med_content_url 

What is the expected output? What do you see instead?
Script should return gracefully but with no data

What version of the product are you using? On what operating system?
PHP 5 Apache 2

Please provide any additional information below.
I have gotten around this by checking the length of
$xml->getElementsByTagNameNS("http://search.yahoo.com/mrss/","content");
before proceeding, and if there is no length throwing an exception.

This is a different issue, but please note that also the Exception404 class
is not complete as it does not pass on its parameters to the base exception
class in the constructor, and also there is no toString function
implemented so you have an undefined function in your sample when you
attempt to catch the exceptino and call toString.

Original issue reported on code.google.com by bcy...@gmail.com on 3 Aug 2008 at 3:56

GoogleCodeExporter commented 8 years ago
On/around line 39:

$xmlContent = 
$xml->getElementsByTagNameNS("http://search.yahoo.com/mrss/","content");
if(!$xmlContent->length){
 throw new Exception404("Requested video cannot be embedded");
}
$med_content_url = $xmlContent->item(0)->getAttribute("url");

Original comment by martin.s...@gmail.com on 11 Oct 2008 at 8:26