Using vget command results in an infinite loop. I have to terminate the loop by hitting ctrl-c.
This symptom happens with Drush 2.1 or current HEAD (2009-Dec-15 bundle, downloaded today). See below for system configuration info.

[user@host html]$ drush vget site_offline
site_offline: "0"
site_offline: "0"
site_offline: "0"
... snip ...

And it happens whether I give a full variable name or a partial one... and I note that the loop stays stuck on the first database result returned:

[user@host html]$ drush vget site
site_403: ""
site_403: ""
site_403: ""
... snip ...

System Configuration

Drupal version is 5.7 (yes, I know it's an old version, I'm preparing to update it now, which is why I'm trying out Drush).

[user@host html]$ drush status
  PHP configuration : /etc/php.ini
  ...snip...
  Drupal version    : 5.7
  Site Path         : sites/default
  Site URI          : http://default
  Database Driver   : mysql
  Database Hostname : localhost
  ...snip...
  Database          : Connected
  Drupal Bootstrap  : Successful
  Drupal User       : Anonymous

[user@host]$ php --version
PHP 5.2.9 (cli) (built: Jul 22 2009 06:06:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

[user@host]$  uname -a
Linux hostname 2.6.18-028stab064.7-ent #1 SMP Thu Aug 20 22:25:02 MSD 2009 i686 i686 i386 GNU/Linux

I don't know if this is due to the presence of the Zend/eAccelerator opcode cache; I can't disable eAccelerator right now but I'll investigate that soon.

I will also investigate whether this is due to the fact that I'm running against Drupal 5.7... I hope not. I'd like to be able to use Drush to update older sites rather than have to update first, then use Drush!

Comments

greg.1.anderson’s picture

What is the output of drush -v -d vget site_offline?

mcurry’s picture

@greg.1.anderson - December 17, 2009 - 10:37

What is the output of drush -v -d vget site_offline?

[user@host html]$ drush -v -d vget site_offline
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.031 sec]                    [bootstrap]
Initialized Drupal 5.7 root directory at /home/webadmin/hostname.com/html [0.041       [notice]
sec]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.043 sec]                    [bootstrap]
Initialized Drupal site default at sites/default [0.066 sec]                             [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.068 sec]           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.096 sec]                [bootstrap]
Successfully connected to the Drupal database. [0.096 sec]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.111 sec]                    [bootstrap]
PHP Notice:  Undefined property: stdClass::$theme in /home/webadmin/hostname.com/html/includes/theme.inc on line 45
PHP Warning:  array_key_exists(): The second argument should be either an array or an object in /home/webadmin/hostname.com/html/includes/module.inc on line 217
PHP Warning:  array_key_exists(): The second argument should be either an array or an object in /home/webadmin/hostname.com/html/includes/module.inc on line 217
Drush bootstrap phase : _drush_bootstrap_drupal_login() [1.105 sec]                   [bootstrap]
Found command: variable get [1.138 sec]                                               [bootstrap]
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
...snip...
greg.1.anderson’s picture

That is odd indeed. I have no experience with Drupal 5.x; perhaps someone else can help.

In the meantime, I would definitely recommend that you get drush up and running on a scratch Drupal 6 site, and then add in the modules you are using in Drupal 5.7 one at a time, confirming that drush continues to work as you go. This will at least isolate the problem to Drupal 5.7 (which does seem to be the likely culprit, given the warning above on module.inc line 217). This will not be wasted work, as it will allow you to verify that all of the modules you need are available and work before you begin migrating your data.

mcurry’s picture

Thanks for your prompt response. I'll investigate further...

mcurry’s picture

Update, for anyone interested in this issue. I upgrade the site to Drupal 5.21, and all modules are now up-to-date. I don't plan on upgrading to D6 just yet, for a variety of reasons. The issue continues to manifest itself.

[user@host html]$ drush -v -d vget site_offline 
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.029 sec]                   [bootstrap]
Initialized Drupal 5.21 root directory at /home/webadmin/host.com/html [0.039     [notice]
sec]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.042 sec]                   [bootstrap]
Initialized Drupal site default at sites/default [0.066 sec]                            [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.068 sec]          [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.089 sec]               [bootstrap]
Successfully connected to the Drupal database. [0.089 sec]                           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.107 sec]                   [bootstrap]
PHP Warning:  array_key_exists(): The second argument should be either an array or an object in /home/webadmin/host.com/html/includes/module.inc on line 217
PHP Warning:  array_key_exists(): The second argument should be either an array or an object in /home/webadmin/host.com/html/includes/module.inc on line 217
Drush bootstrap phase : _drush_bootstrap_drupal_login() [1.465 sec]                  [bootstrap]
Found command: variable get [1.478 sec]                                              [bootstrap]
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
site_offline: "0"
... snip ...

edit: removed dumb question. The search continues...

mcurry’s picture

Edit: second dumb question unasked. Time to go back to db_result() school.

Edit # 2: Looks like db_result() (which is called by drush_db_result() in D5 and D6) needs a row cursor parameter in D5 and D6 -- otherwise, it always returns the first row of the resultset. See:
#36892: Make db_result more useable.

Also appears that vget just plain doesn't work in D5 (and perhaps D6) based on my research. But, I've been wrong several times today...

greg.1.anderson’s picture

Looks like you're doing some good work tracking down this issue. A few comments and suggestions:

  1. I can assure you that vget works in D6, so the D7 patch you quote above is not required
  2. Try reproducing on a clean install of D5 to see if one of your modules might be affecting the vget dispatch
  3. Try on D6 as I suggested in #3
  4. Get a php source level debugger (maybe netbeans) and step through the code to see where it loops back around to call vget again and again

Good luck.

moshe weitzman’s picture

Title: vget (variable get) infinite loop » vget (variable get) infinite loop in D5
Priority: Normal » Minor
jonhattan’s picture

moshe weitzman’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.