From:             tiposchi at tiscali dot it
Operating system: GNU/Linux
PHP version:      5.2.9
PHP Bug Type:     CGI related
Bug description:  POST Data being ignored

Description:
------------
CGI protocol says that POST data must be passed to the script using
its standard input.

So what i have to do is something like (see the attached code).

Anyway, the php knows how long the input will be because it has an
environmental variable called content length that says it.

So php should wait to read the entire post data before going on.
Since i don't have any information about how the scheduler works, i
can't assure the father process to fill the pipe before the child is
scheduled.

But php ignores the data if the pipe isn't full already. So what i
did was filling the pipe BEFORE the fork, and doing this it works.
But there is another problem. With large POST data, the buffer is
filled and the OS puts my process on wait until the pipe is empty by
another process. But i didn't start the php yet because it wants all
the post data already present, so the webserver just hangs.

I think you should review the way php-cgi reads post data.

Thanks

Reproduce code:
---------------
p=pipe()

if (fork()==0) {
    close(STDIN)
    dup(p)
    exec ("php")
} else {
    write(p,str_post)
    wait()
}

I HAVE MADE THE CODE SIMPLE. I KNOW THIS CAN'T WORK.


-- 
Edit bug report at http://bugs.php.net/?id=47825&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47825&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47825&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47825&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47825&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47825&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47825&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47825&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47825&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47825&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47825&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47825&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47825&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47825&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47825&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47825&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47825&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47825&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47825&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47825&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47825&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47825&r=mysqlcfg

Reply via email to