[Phpmyadmin-devel] refactoring and superglobals

Thilina Buddika Abeyrathna thilinaabeyrathna at gmail.com
Fri May 11 04:44:02 CEST 2012


On Mon, May 7, 2012 at 7:14 PM, Thilina Buddika Abeyrathna <
thilinaabeyrathna at gmail.com> wrote:

>
>
> On Mon, May 7, 2012 at 5:34 PM, Marc Delisle <marc at infomarc.info> wrote:
>
>> Hi,
>>
>> We previously had a script called grab_globals.lib.php, which created
>> global variables from a few superglobals arrays.
>>
>> When this script was removed a few weeks ago, we added at the beginning
>> of other scripts some code, for example in tbl_change.php:
>>
>> if (isset($_REQUEST['where_clause'])) {
>>    $where_clause = $_REQUEST['where_clause'];
>> }
>>
>> In the upcoming refactoring efforts, we should avoid this, because,
>> looking at the code further in the script, it's difficult to see the
>> origin of $where_clause. So, we should only refer to
>> $_REQUEST['where_clause'] (except in the situations where the global is
>> modified afterwards).
>>
>> Another benefit is that this variable would not need to be passed as a
>> parameter to functions.
>
>
> Hi Marc,
> Thank you very much for pointing out.
>
> Hi Marc,
when I write functions for columns(function column, null column, value
column, ...) in insert form (line 408 in tbl_change.php) I have to pass lot
of parameters. But it is not a good practice for refactoring. And use
global variables also not a good solution. So is it ok to use a parameter
array. I need to pass around 10 parameters. I like to see your suggestions.



-- 
Regards.

Thilina Buddika Abeyrathna,
Department of Computer Engineering,
Faculty Of Engineering,
University of Peradeniya,
Sri Lanka.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120511/9c0ca5d4/attachment.html>


More information about the Developers mailing list