backdrop-contrib / coder_upgrade

Helps automate some/most of the work required to upgrade a module from Drupal to Backdrop 1.x
GNU General Public License v2.0
4 stars 7 forks source link

variable_get() with booleans still not fully handled properly #52

Closed bugfolder closed 3 years ago

bugfolder commented 3 years ago

Some situations were fixed by PR 42, but others are not and strings that happen to be equal to boolean values are not. The following test code shows some examples:

  variable_get('coder_upgrade_test_bool', TRUE);
  variable_get('coder_upgrade_test_str1', "TRUE");
  variable_get('coder_upgrade_test_str2', 'TRUE');
  variable_get('coder_upgrade_test_str3', 'BLUE');

.install file contains:

  $config->set('coder_upgrade_test_bool', update_variable_get('coder_upgrade_test_bool', TRUE));
  $config->set('coder_upgrade_test_str1', update_variable_get('coder_upgrade_test_str1', '"TRUE"'));
  $config->set('coder_upgrade_test_str2', update_variable_get('coder_upgrade_test_str2', TRUE));
  $config->set('coder_upgrade_test_str3', update_variable_get('coder_upgrade_test_str3', 'BLUE'));

.json file contains:

    "coder_upgrade_test_bool": true,
    "coder_upgrade_test_str1": "\"TRUE\"",
    "coder_upgrade_test_str2": true,
    "coder_upgrade_test_str3": "BLUE",

In both cases, 2nd and 3rd are wrong; the values should be ordinary string values.

bugfolder commented 3 years ago

Fixed by https://github.com/backdrop-contrib/coder_upgrade/pull/53.