[wp-trac] [WordPress Trac] #20246: When adding a url to video

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 27 11:18:56 UTC 2012


#20246: When adding a url to video
------------------------------+--------------------
 Reporter:  dimitrov.adrian   |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.4.2
Component:  Media             |     Version:  3.3.1
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+--------------------
Changes (by SergeyBiryukov):

 * milestone:  3.5 => 3.4.2


Comment:

 The `wp_oembed_get()` PHPDocs fix was already committed in [20562].

 I've tried to reproduce the original issue and this time the result was
 different from comment:3.

 The data was properly fetched, but then discarded due to `is_string(
 $data->html )` returning false: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/class-
 oembed.php#L248

 `is_string()` check was introduced in [20539], two weeks after comment:3,
 which explains the different results. Seems that before [20539], the
 object was somehow automatically converted to string on my PHP install, so
 I didn't get the error.

 I've disabled `WP_Embed` cache to get consistent results and make sure
 it's not a network glitch.

 `var_dump( $data->html )` returned this:
 {{{
 object(SimpleXMLElement)#266 (1) {
   [0]=>
   string(507) "<object classid="clsid:D27CDB6E-AE6D-11cf-
 96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
 width="450" height="403"><param name="movie"
 value="http://i48.vbox7.com/player/ext.swf?vid=26c23d8d"><param
 name="quality" value="high"><embed
 src="http://i48.vbox7.com/player/ext.swf?vid=26c23d8d" quality="high"
 pluginspage="http://www.macromedia.com/go/getflashplayer"
 type="application/x-shockwave-flash" width="450"
 height="403"></embed></object>"
 }
 }}}

 At first I thought that vbox7 returns an object for the `html` value (like
 Viddler in [comment:ticket:20322:2]), but this doesn't seem to be the
 case, the response looks proper: [[BR]]
 http://vbox7.com/etc/oembed/?maxwidth=625&maxheight=600&url=http%3A%2F%2Fvbox7.com%2Fplay%3Aa3dffea7&format=xml

 Then I removed `json` from
 [http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/class-
 oembed.php#L166 line 166] to force YouTube to use XML and got a similar
 response: [[BR]]
 http://www.youtube.com/oembed?maxwidth=625&maxheight=600&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DD7vS4z6ngQo&format=xml

 No video was displayed in the post. `var_dump()` showed that `$data->html`
 was a SimpleXMLElement object (like the one above). Looks like [20539]
 broke XML oEmbed responses, which is a regression.

 According to the php.net manual, we should cast the elements to strings:
 [[BR]]
 http://www.php.net/manual/en/simplexml.examples-basic.php#example-5103

 [attachment:20246.2.patch] does that.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20246#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list