Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.7

Bug #6295 $HTTP_RAW_POST_DATA not set
Submitted: 2005-12-19 20:51 UTC Modified: 2006-01-25 11:34 UTC
From: me at thomaskeller dot biz Assigned: jeichorn
Status: Closed Package: HTML_AJAX
PHP Version: 4.3.11 OS: Linux FC4
Roadmaps: (Not assigned)    
Subscription  


 [2005-12-19 20:51 UTC] me at thomaskeller dot biz
Description: ------------ $HTTP_RAW_POST_DATA wasn't set on my system for whatever reason (maybe because I set register_globals to off, there is a php bug about that here [0]), thus instead of getting the JSON encoded result of my AJAX request, I got a "undefined variable: $HTTP_RAW_POST_DATA". This can be fixed by altering line 462 of AJAX.php: - return $GLOBALS['HTTP_RAW_POST_DATA']; + return isset($GLOBALS['HTTP_RAW_POST_DATA']) ? + $GLOBALS['HTTP_RAW_POST_DATA'] : + implode("\r\n", file('php://input')); [0] http://bugs.php.net/bug.php?id=22338

Comments

 [2005-12-19 20:52 UTC] me at thomaskeller dot biz
btw... I'm using HTML_AJAX-0.3.3
 [2005-12-19 21:14 UTC] jeichorn at php dot net
HTTP_RAW_POST_DATA should always be set if the mime type of the input is unknown. I'm willing to put this patch in, but i would like to see if there is a header problem that is causing it, or just yet another BC issue with PHP 5.1 Can you include the headers sent from the request, (Firefox Live HTTP Headers works good for that) and the value of $_POST (should be empty but i'd like to check). Also whats your apache version
 [2005-12-19 22:33 UTC] me at thomaskeller dot biz
At first, sorry that I've initially posted the wrong PHP version, I just did php -v on cmdline while totally forgetting about the fact that I have still 4.3.11 running on my webserver. The output of $_POST is always array(). Here is the LiveHeaders snippet: http://localhost/v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=setsaveindb POST /v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=setsaveindb HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de,en;q=0.7,en-us;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive Content-Type: application/json; charset=UTF-8; charset=utf-8 Content-Length: 6 Cookie: userid=4; pass=bda916b341a47301b41001b28e0c5fab; ZDEDebuggerPresent=php,phtml,php3; PHPSESSID=5811fdf5690c5a1ec3d2b141106ee0f6 Pragma: no-cache Cache-Control: no-cache [true] HTTP/1.x 200 OK Date: Tue, 20 Dec 2005 03:22:51 GMT Server: Apache/2.0.54 (Fedora) X-Powered-By: PHP/4.3.11 Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/ Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Content-Length: 6 Last-Modified: Tue, 20 Dec 2005 03:22:51GMT Connection: close Content-Type: application/json; charset=utf-8
 [2005-12-19 22:43 UTC] jeichorn at php dot net
Thanks for the help on debugging the root cause Any chance you could run your test without the zend debugging enabled. And get the value of $_SERVER['Content-Type'] We should have your patch in the next release, i just want to verify what is really happening
 [2005-12-20 00:20 UTC] me at thomaskeller dot biz
The server vars do not contain an entry for content-type (in neither spelling): array(32) { ["UNIQUE_ID"]=> string(24) "yA7cz8CoAgoAADquEfwAAAAC" ["HTTP_HOST"]=> string(9) "localhost" ["HTTP_USER_AGENT"]=> string(71) "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5" ["HTTP_ACCEPT"]=> string(99) "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" ["HTTP_ACCEPT_LANGUAGE"]=> string(23) "de,en;q=0.7,en-us;q=0.3" ["HTTP_ACCEPT_ENCODING"]=> string(12) "gzip,deflate" ["HTTP_ACCEPT_CHARSET"]=> string(7) "UTF-8,*" ["HTTP_KEEP_ALIVE"]=> string(3) "300" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_COOKIE"]=> string(77) "ZDEDebuggerPresent=php,phtml,php3; PHPSESSID=bc9154451d5cf4349003c9d4505c0776" ["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0" ["PATH"]=> string(44) "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" ["SERVER_SIGNATURE"]=> string(70) "<address>Apache/2.0.54 (Fedora) Server at localhost Port 80</address> " ["SERVER_SOFTWARE"]=> string(22) "Apache/2.0.54 (Fedora)" ["SERVER_NAME"]=> string(9) "localhost" ["SERVER_ADDR"]=> string(9) "127.0.0.1" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(9) "127.0.0.1" ["DOCUMENT_ROOT"]=> string(13) "/data/webroot" ["SERVER_ADMIN"]=> string(20) "root@localhost" ["SCRIPT_FILENAME"]=> string(26) "/data/webroot/v1/index.php" ["REMOTE_PORT"]=> string(5) "47530" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(4) "/v1/" ["SCRIPT_NAME"]=> string(13) "/v1/index.php" ["PHP_SELF"]=> string(13) "/v1/index.php" ["PATH_TRANSLATED"]=> string(26) "/data/webroot/v1/index.php" ["argv"]=> array(0) { } ["argc"]=> int(0) } This is with ZDE client/server disabled (note that the cookie isn't deleted but it shouldn't do any harm): http://localhost/v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=getlist POST /v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=getlist HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de,en;q=0.7,en-us;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive Content-Type: application/json; charset=UTF-8; charset=utf-8 Content-Length: 4 Cookie: ZDEDebuggerPresent=php,phtml,php3; PHPSESSID=bc9154451d5cf4349003c9d4505c0776 Pragma: no-cache Cache-Control: no-cache null HTTP/1.x 200 OK Date: Tue, 20 Dec 2005 05:13:44 GMT Server: Apache/2.0.54 (Fedora) X-Powered-By: PHP/4.3.11 Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Content-Length: 230 Last-Modified: Tue, 20 Dec 2005 05:13:44GMT Connection: close Content-Type: application/json; charset=utf-8 ----------------------------------------------------------
 [2005-12-20 00:21 UTC] me at thomaskeller dot biz
The server vars do not contain an entry for content-type (in neither spelling): array(32) { ["UNIQUE_ID"]=> string(24) "yA7cz8CoAgoAADquEfwAAAAC" ["HTTP_HOST"]=> string(9) "localhost" ["HTTP_USER_AGENT"]=> string(71) "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5" ["HTTP_ACCEPT"]=> string(99) "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" ["HTTP_ACCEPT_LANGUAGE"]=> string(23) "de,en;q=0.7,en-us;q=0.3" ["HTTP_ACCEPT_ENCODING"]=> string(12) "gzip,deflate" ["HTTP_ACCEPT_CHARSET"]=> string(7) "UTF-8,*" ["HTTP_KEEP_ALIVE"]=> string(3) "300" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_COOKIE"]=> string(77) "ZDEDebuggerPresent=php,phtml,php3; PHPSESSID=bc9154451d5cf4349003c9d4505c0776" ["HTTP_CACHE_CONTROL"]=> string(9) "max-age=0" ["PATH"]=> string(44) "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" ["SERVER_SIGNATURE"]=> string(70) "<address>Apache/2.0.54 (Fedora) Server at localhost Port 80</address> " ["SERVER_SOFTWARE"]=> string(22) "Apache/2.0.54 (Fedora)" ["SERVER_NAME"]=> string(9) "localhost" ["SERVER_ADDR"]=> string(9) "127.0.0.1" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(9) "127.0.0.1" ["DOCUMENT_ROOT"]=> string(13) "/data/webroot" ["SERVER_ADMIN"]=> string(20) "root@localhost" ["SCRIPT_FILENAME"]=> string(26) "/data/webroot/v1/index.php" ["REMOTE_PORT"]=> string(5) "47530" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(4) "/v1/" ["SCRIPT_NAME"]=> string(13) "/v1/index.php" ["PHP_SELF"]=> string(13) "/v1/index.php" ["PATH_TRANSLATED"]=> string(26) "/data/webroot/v1/index.php" ["argv"]=> array(0) { } ["argc"]=> int(0) } This is with ZDE client/server disabled (note that the cookie isn't deleted but it shouldn't do any harm): http://localhost/v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=getlist POST /v1/livebookmarks.php?c=mmmdi_ajax_livebookmarks&m=getlist HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de,en;q=0.7,en-us;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive Content-Type: application/json; charset=UTF-8; charset=utf-8 Content-Length: 4 Cookie: ZDEDebuggerPresent=php,phtml,php3; PHPSESSID=bc9154451d5cf4349003c9d4505c0776 Pragma: no-cache Cache-Control: no-cache null HTTP/1.x 200 OK Date: Tue, 20 Dec 2005 05:13:44 GMT Server: Apache/2.0.54 (Fedora) X-Powered-By: PHP/4.3.11 Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Content-Length: 230 Last-Modified: Tue, 20 Dec 2005 05:13:44GMT Connection: close Content-Type: application/json; charset=utf-8 ----------------------------------------------------------
 [2006-01-25 11:34 UTC] jeichorn at php dot net
Resolved will be in 0.3.4