PDA

View Full Version : PATCH: Convert Meta _GET And Meta _POST To Meta _REQUEST


James Wells
21-10-2005, 21:35
Greetings,

This patch is meant to lay the ground work for various efforts that are underway regarding the UI. It does this by converting the UI from using the $_GET and $_POST meta variables to $_REQUEST meta variables.

This patch replaces all instances of $_GET with $_REQUEST. By changing the meta variable from _GET / _POST to _REQUEST, we are making it a bit easier to begin various porting efforts. Majority of CMS interface systems use the POST method by default, whereas the current Zabbix implementation uses the GET method. With this patch in place we can begin to standardize certain logic checks without having to worry about wether the HTML request uses a POST or GET method.

From the end user's perspective there should be zero change with this patch, this is almost exclusively a PHP dev change.

Alexei
23-10-2005, 16:17
Hi James,

I like this patch. However I'm a bit worried about the following:

- $_REQUEST has been introduced in PHP 4.1.0. Is it safe to assume that most of users ar on PHP >4.1.0?
- does it work in Configuration of Images Screen?
- does $_REQUEST's behaviour relies on any configuration parameters of php.ini?

Thanks.

James Wells
23-10-2005, 18:01
- $_REQUEST has been introduced in PHP 4.1.0. Is it safe to assume that most of users ar on PHP >4.1.0?
I decided to go an double check this. As I understand from the documentation at the PHP site, $_GET, $_POST, and $_REQUEST were all added at roughly the same time;
PHP: Variables from outside PHP - Manual (http://us3.php.net/variables.external)

I will look through the code again, but as I read the above, they would already require 4.1 in order to run the 1.1 Zabbix UI.

- does it work in Configuration of Images Screen?
While I didn't test the image configuration screen, I did test it in many other locations and it appears to work correctly. Will test the image configuration today, just in case.

EDIT: Just tested this. Yes, it works correctly, however, I did just find a bug in the images section, but not from this patch. When you click on 'Change' from the Images configuration screen, you only have the options to add or delete, not update. Will write a patch to fix that today as well.

- does $_REQUEST's behaviour relies on any configuration parameters of php.ini?
I suspect you are worrying about the 'register_globals' config option. If I read the above listed URL, then no, there is no change needed as the $_GET / $_POST / $_REQUEST are all listed as what they call "Superglobals"

Alexei
24-10-2005, 08:02
Thanks for the detailed response. I'll integrate this patch shortly.

Alexei
24-10-2005, 08:29
The patch has been integrated. Thanks.