[Phpmyadmin-devel] [GSoC2012] Refactoring: Table search, Db search, Multi-table query

Marc Delisle marc at infomarc.info
Tue Apr 3 16:53:14 CEST 2012


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.

-- 
Marc Delisle
http://infomarc.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: OpenPGP digital signature
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120403/7ea141a3/attachment.sig>


More information about the Developers mailing list