On Tue, Apr 3, 2012 at 8:23 PM, Marc Delisle <marc@infomarc.info> wrote:
Le 2012-04-02 18:39, Ammar Yasir a écrit :
> Hi,
> Can we have more clarity on improving reference to global variables. Is the
> following snippet an example of the same where?
> (From tbl_select.php, $_POST parameters are referenced through $GLOBALS)
> $post_params = array(
>     'ajax_request',
>     'collations',
>     'db',
>     'distinct',
>     'fields',
>     'func',
>     'max_number_of_fields',
>     'names',
>     'order',
>     'orderField',
>     'param',
>     'session_max_rows',
>     'table',
>     'types',
>     'where',
> );
> foreach ($post_params as $one_post_param) {
>     if (isset($_POST[$one_post_param])) {
>         $GLOBALS[$one_post_param] = $_POST[$one_post_param];
>     }
> }

Ammar,
this snippet is code added recently, to be able to remove the
grab_globals.lib.php library.

tbl_select.php uses globals instead of directly referencing
$_POST['foo'] so this snippet was a way to keep the script working until
better refactoring.

However, many scripts are using other global variables as a way to
communicate between them or between functions, and we should try to
minimize this behavior.

Is the use of $sql_query variable as a GET variable for sql.php  an example of the same?
(communication between scripts) 
--
Marc Delisle
http://infomarc.info


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel