ID:               45540
 User updated by:  jdespatis at yahoo dot fr
 Reported By:      jdespatis at yahoo dot fr
-Status:           Feedback
+Status:           Open
 Bug Type:         Streams related
 Operating System: Linux Kubuntu
 PHP Version:      5.2.6
 Assigned To:      fb-req-jani
 New Comment:

Well, i can give you a self-contained reproducing script:
http://www.despatis.com/php/stream.phps

But, it's impossible for me to avoid the use of POST, because this bug
occurs on a http connection..

To run the bug, you just do in the command line (so using php cli):
$ php stream.php

I get the following result, you'll need a sniffer to see that data sent
to http server is completely weird

token :
AIwbFASbZooZXBAePnl4eayE1cZvRWbvOtzQTC-vRR-lkp1r3ijZ7AxoSIzuslTVmufPznylay34ryUPdLRMGh61cidHS29Z7NkKqLVYr2JdNY4iKN0qoVB2MSaV2rmumH_ZJTo3gp7Or0IJlaiMiNEs2R5aNllOYg
Array
(
    [type] => 2
    [message] =>
file_get_contents(http://uploads.gdata.youtube.com/feeds/api/users/bigbluezen/uploads):
failed to open stream: HTTP request failed! HTTP/1.0 411 Length
Required

    [file] =>
/home/enzo/projects/lacartoonerie/download/modules/stream.php
    [line] => 101
)


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

[2008-07-20 11:10:00] [EMAIL PROTECTED]

Ok. Now can you provide a proper self-contained reproducing script. One
that starts with <?php, ends with ?> and can be run on the command line.
ie. no POST required..

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

[2008-07-18 16:45:03] jdespatis at yahoo dot fr

[EMAIL PROTECTED]:~$ cat php-5.2.6/config.nice

#! /bin/sh
#
# Created by configure

'./configure' \
'--enable-sockets' \
'--enable-soap' \
'--with-mysql' \
'--enable-mbstring' \
'--enable-ftp' \
'--with-zlib' \
'--with-openssl' \
'--prefix=/home/enzo/divers/php_compil/' \
'--exec-prefix=/home/enzo/divers/php_compil/' \
'--disable-short-tags' \
"$@"

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

[2008-07-18 16:05:44] [EMAIL PROTECTED]

For the second time: What was the configure line you used to build PHP?

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

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

And to help to diagnose the problem

i can perfectly make this script work if I code the stream by my own
for example, I replace stream_context_create by some code using
fsockopen, all works perfectly ... (i really think stream_context_create
leaves some \r \n in some special case ...)

$context = stream_context_create($opts);
$buff =
@file_get_contents("http://uploads.gdata.youtube.com/feeds/api/users/$username/uploads";,
false, $context);

by

$fp = fsockopen("uploads.gdata.youtube.com", 80, $errno, $errstr, 30);
if (!$fp) {
  return "Youtube unreachable $errstr ($errno)";
}
$out  = "POST /feeds/api/users/$username/uploads HTTP/1.0\r\n";
$out .= "Host: uploads.gdata.youtube.com\r\n";
$out .= "Content-Length: " . strlen($opts["http"]["content"] ."\r\n";
$out .= "Connection: Close\r\n";
$out .= $opts["http"]["header"];
$out .= "\r\n";
$out .= $opts["http"]["content"];
fwrite($fp, $out);
$buff = "";
while (!feof($fp)) {
  $buff .= fgets($fp, 4096);
}
fclose($fp);

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

[2008-07-18 08:44:26] jdespatis at yahoo dot fr

No this bug is different than bug 43222.
In the latter the post content seems to be good except a CRLF more
which is not dramatic

In my case, the post content and header are completely broken...

I've modified my configuration to forbid short open tag
(i check with echo ini_get("short_open_tag") which returns nothing
meaning false)

and i get the same bug.

But as I said, one could thing the bug comes from here (i've thought
also), but not at all, the bug disappear if i let the short tag <? but
change something else

Php behavior is really weird...

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/45540

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

Reply via email to