ID:               45540
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jdespatis at yahoo dot fr
-Status:           Open
+Status:           Feedback
 Bug Type:         Streams related
 Operating System: Linux Kubuntu
 PHP Version:      5.2.6
 New Comment:

Are you sure this isn't same issue as reported in bug #43222 ?
What was the configure line you used to configure PHP?
Is short_open_tag enabled? Check from phpinfo()!


Previous Comments:
------------------------------------------------------------------------

[2008-07-17 07:14:41] jdespatis at yahoo dot fr

Oups, my script bug.php contains a function

To test it, one can use this simple script :
(no need to create a nothing.mp4 to use this example)

<?php
  include("bug.php");
  $params = array("username" => "bigbluezen", "password" => "demo",
"title" => "ultimate video topmoumoute", "tags" => "test machin bidule",
"channel" => "poetic");

  print_r(publish("nothing.mp4", $params));
?>

------------------------------------------------------------------------

[2008-07-17 07:10:23] jdespatis at yahoo dot fr

Description:
------------
I'm coding a little script to upload a video on Youtube, thanks to
stream functions in php.

It takes 2 steps:
1/ first connect on google to retrieve token, no problem with php code
2/ upload video with a query in POST, and there stream_context_create
is giving a completely broken query.. From time to time, i can make it
work, but it's pure random

I have used a sniffer as wireshark to see the exact http query

Reproduce code:
---------------
Here is the piece of code that does all this stuff:
http://www.despatis.com/php/bug.phps

Expected result:
----------------
PHP CLIENT => YOUTUBE SERVER:
POST /feeds/api/users/bigbluezen/uploads HTTP/1.0
Host: uploads.gdata.youtube.com
Content-Length: 792
Content-Type: multipart/related;
boundary="---------------------------cefe168b3cb99683a0f9ebd6f9b2cca6"
Authorization: GoogleLogin
auth=AIwbFAQtr5MDW_ctllHioiYCpY6I_uF6A9zBcSbIQ8AceGbcYfqrmytEICM8p6VjjzygDd2HPL0YhTcVk2MPmtb9y93-9Fs3yiej8hBtLF60_N_a6aWDg9Mrbm18nP-2dTVvTA6h77eJZrOJICzgN3dZyPT4AN1ffQ
X-GData-Client: ytapi-SourceRH-LaCartoonerie-3lludu8g-0
X-GData-Key:
key=AI39si44WZavBNwYryVhVFaMH4Y8e0JbTAr83bScAxKby6LBW3xEyBzaXrV7MTw3sm56SmYVhSOWRXNfUrS0sqC1i7313ycFrQ
Slug: c447e7c1c0b79e8dc97c76cdc16e9843.gif

-----------------------------cefe168b3cb99683a0f9ebd6f9b2cca6
Content-Type: application/atom+xml; charset=UTF-8

<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom";
xmlns:media="http://search.yahoo.com/mrss/";
xmlns:yt="http://gdata.youtube.com/schemas/2007";>
  <media:group>
    <media:title type="plain">title foo</media:title>
    <media:description type="plain">description
foo</media:description>
    <media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat";>People</media:category>
    <media:keywords>key1, key2</media:keywords>
  </media:group>
</entry>

-----------------------------cefe168b3cb99683a0f9ebd6f9b2cca6
Content-Type: video/gif
Content-Transfer-Encoding: binary

XXX
-----------------------------cefe168b3cb99683a0f9ebd6f9b2cca6--

Actual result:
--------------
The actual result, found with a sniffer (wireshark for example) is:

PHP CLIENT => YOUTUBE SERVER:
POST
/feeds/api/users/bigbluezen/uploads/wFqcFtuB9MY?client=ytapi-SourceRH-LaCartoonerie-3lludu8g-0
HTTP/1.0
Host: gdata.youtube.com
Authorization: GoogleLogin
auth=AIwbFASurkAdrgigXGJeP24Ebc0dM7EierouUTZ7Nqm2pjSzo2aRtNXQgOo-_ebco_-w7CmpxcZqysZKS_UGCUSc-K6tD5NI84jIc7sf1Sq8cPtcbknOrvlqxF6PNBj-kLzeXEPnBwKoE4vJDuwE0ag7Aleyo-u3hw
X-GData-Client: ytapi-SourceRH-LaCartoonerie-3lludu8g-0
X-GData-Key:
key=AI39si44WZavBNwYryVhVFaMH4Y8e0JbTAr83bScAxKby6LBW3xEyBzaXrV7MTw3sm56SmYVhSOWRXNfUrS0sqC1i7313ycFrQ
Slug:
c447e7c1c0b79e8dc97c76cdc16e9843.gifbScAxKby6LBW3xEyBzaXrV7MTw3sm56SmYVhSOWRXNfUrS0sqC1i7313ycFrQ
Slug: c447e7c1c0b79e8dc97c76cdc16e9843.gif

EOF

As you can see, the first query is completely messy !!

The funny thing is that: if i change '<?xml version="1.0"?>' to '<xml
version="1.0">' at line 64, the http query is good...

One could thing <? is interpreted by php, but in fact no... it also
works if i keep the <? and ?> in the xml and change another things (add
an echo somewhere, but this trick doesn't work all the time)

As the result is very random, i think file_get_contents doesn't get all
data from the string, leaving some \r\n, which mess the following http
query, maybe something like that...



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45540&edit=1

Reply via email to