ID: 25231 User updated by: tim at zero-interactive dot com Reported By: tim at zero-interactive dot com Status: Bogus Bug Type: Variables related Operating System: Win2K Pro PHP Version: 4.3.2 New Comment:
No need to get nasty. I wasn't asking for help, was only reporting behaviour which I believe to be incorrect (which is what this site exists for). If you say its a feature, then fine, I'll take your word for it even though none of you have bothered to explain why it is correct. Your "feature" is however inconsistent in the way that it works. If I change the form method to GET instead of POST, then I only get some of the information sent back in the GET array. Namely, only the data in the input fields in the form and not the data in the query part of the action uri. If you have no intention of fixing what I believe to be wrong, then at the very least change the documentation in the manual to reflect this undocumented (that I know of) feature: Except from online manual (Predefined variables page): $_GET Variables provided to the script via HTTP GET. Analogous to the old $HTTP_GET_VARS array (which is still available, but deprecated). $_POST Variables provided to the script via HTTP POST. Analogous to the old $HTTP_POST_VARS array (which is still available, but deprecated). You will note that it says "provided to the script via HTTP GET". I just proved to you that you can get data in the $_GET array with a HTTP POST as demonstrated by the headers I captured. This means that either the engine is wrong or the documentation is wrong. Which one is it? Previous Comments: ------------------------------------------------------------------------ [2003-08-25 18:59:43] [EMAIL PROTECTED] This is called FEATURE..it's definately NOT bug. Please ask support questions elsewhere.. ------------------------------------------------------------------------ [2003-08-25 18:54:16] tim at zero-interactive dot com I dont understand how this can be correct behaviour. There is never a GET header sent with the request, so this means that the $_GET array should not be populated. If you have a close look at the HTTP headers that I've captured, there is only a POST request header sent and not a GET request header. ------------------------------------------------------------------------ [2003-08-25 18:47:17] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is the correct behaviour. ------------------------------------------------------------------------ [2003-08-25 12:24:48] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-08-25 00:39:32] tim at zero-interactive dot com Description: ------------ I'm pretty sure this is wrong, feel free to correct me if it is. Basically if you POST form data from a form that has its action set to "upload.php?action=add", you get both _GET and _POST data accessible to your script. It "seems" that the $_GET arrays is not respecting the HTTP headers sent by the browser and is getting its data by blindly parsing the url. Shouldn't it first check the headers sent to see if it was sent with the GET method? Reproduce code: --------------- The headers that my browser sent are as follows: http://192.168.4.105:8080/gallery/upload.php?action=add POST /gallery/upload.php?action=add HTTP/1.1 Host: 192.168.4.105:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate,compress;q=0.9 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://192.168.4.105:8080/gallery/upload.php Content-Type: multipart/form-data; boundary=---------------------------265001916915724 Content-Length: 1588 -----------------------------265001916915724 Content-Disposition: form-data; name="category" 2 -----------------------------265001916915724 Content-Disposition: form-data; name="photo_filename[]"; filename="" Content-Type: application/octet-stream -----------------------------265001916915724 Content-Disposition: form-data; name="photo_caption[]" -----------------------------265001916915724 Content-Disposition: form-data; name="photo_filename[]"; filename="" Content-Type: application/octet-stream -----------------------------265001916915724 Content-Disposition: form-data; name="photo_caption[]" -----------------------------265001916915724 Content-Disposition: form-data; name="photo_filename[]"; filename="" Content-Type: application/octet-stream -----------------------------265001916915724 Content-Disposition: form-data; name="photo_caption[]" -----------------------------265001916915724 Content-Disposition: form-data; name="photo_filename[]"; filename="" Content-Type: application/octet-stream -----------------------------265001916915724 Content-Disposition: form-data; name="photo_caption[]" -----------------------------265001916915724 Content-Disposition: form-data; name="photo_filename[]"; filename="" Content-Type: application/octet-stream -----------------------------265001916915724 Content-Disposition: form-data; name="photo_caption[]" -----------------------------265001916915724 Content-Disposition: form-data; name="addPhotos" Add Photos -----------------------------265001916915724-- HTTP/1.x 200 OK Date: Mon, 25 Aug 2003 05:14:35 GMT Server: Apache/2.0.44 (Win32) PHP/4.3.0 Accept-Ranges: bytes X-Powered-By: PHP/4.3.0 Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 ---------------------------------------------------------- Expected result: ---------------- I would have expected to get the action variable from parsing the url of the script rather than through the $_GET array. Seeing as only a POST HTTP header was sent and not a GET HTTP header, I wouldn't have expected to see anything at all in the $_GET array and definitely not a combination of both in $_REQUEST. The result of a print_r on $_GET, $_POST and $_REQUEST should be as follows: $_GET ----- Array ( ) $_POST ------ Array ( [category] => 2 [photo_caption] => Array ( [0] => [1] => [2] => [3] => [4] => ) [addPhotos] => Add Photos ) $_REQUEST --------- Array ( [category] => 2 [photo_caption] => Array ( [0] => [1] => [2] => [3] => [4] => ) [addPhotos] => Add Photos ) Actual result: -------------- The result that I ot back was this: $_GET ----- Array ( [action] => add ) $_POST ------ Array ( [category] => 2 [photo_caption] => Array ( [0] => [1] => [2] => [3] => [4] => ) [addPhotos] => Add Photos ) $_REQUEST --------- Array ( [action] => add [category] => 2 [photo_caption] => Array ( [0] => [1] => [2] => [3] => [4] => ) [addPhotos] => Add Photos ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25231&edit=1