Is the use of the $GLOBALS array in Drupal in anyway 'less secure' or 'bad practice'? Is the use of the $GLOBALS array in Drupal in anyway 'less secure' or 'bad practice'. Like using:

$GLOBALS['user']-&gt;uid


instead of

$account-&gt;uid


if it were avialable?

Thanks.
Directing using

global $user
$user-&gt;uid


adds a new variable to your current scope, which adds potential for misuse and other accidents.

Using 

$GLOBALS['user']-&gt;uid


can be seen as a safety precaution.  You can still mess things up, but it is somewhat harder, and you don't introduce a new variable.

However, directly poking around in the $user object is bad in a lot of cases, especially explicitly using $user-&gt;uid.

Whenever possible, you should leverage the API.  For example, use

if (user_is_logged_in()) { ... }


instead of

global $user;
if ($user-&gt;uid) { ... }


and use user_access() instead of using $user-&gt;roles.

One place where explicit $user-&gt;uid use may be needed is with database queries, though that can be lessened somewhat with EntityFieldQuery-&gt;addAccount and db_select-&gt;addtag('node_access').