Problem/Motivation

When migrating tfa user settings, the following warnings are displayed :

[warning] Attempt to read property "sms" on array MigrateTfaUserSettings.php:98
[warning] Attempt to read property "plugins" on array MigrateTfaUserSettings.php:104

Note : i didn't use SMS on my previous instance.

Steps to reproduce

drush migrate:import tfa_migration_user_settings (or drush migrate:import tfa_migration_user_settings --upgrade)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jibus created an issue. See original summary.

bhanu951’s picture

Hi @jibus, Thanks for reporting the issue.

I observed that warning only for one of my records that are being migrated which doesn't have sms plugin value and for other records it migrated with out warning.

Are you seeing it for multiple records ?

Even though there is a warning I believe TFA is working as expected on newer system?

Did you test TFA on newer system?

Can you ping me on Drupal slack @bhanu951, we can discuss it over there.

bhanu951’s picture

I believe we should add empty variable $decoded_data check at this line.

Can you add that check and confirm if it fixes the notice.

https://git.drupalcode.org/project/tfa_migration/-/blob/1.x/src/Plugin/m...

jibus’s picture

$data_sms = (isset($decoded_data->sms)) ? boolval($decoded_data->sms) : FALSE;

fix the warning "[warning] Attempt to read property "sms" on array MigrateTfaUserSettings.php:98"

    // If the user has TFA enabled, convert the enabled plugins from their
    // Drupal 7 names and values to their Drupal 9 names and values.
    if (isset($decoded_data->plugins)) {

fix the warning : "[warning] Attempt to read property "plugins" on array MigrateTfaUserSettings.php:104"

bhanu951’s picture

Status: Active » Needs work
bhanu951’s picture

Status: Needs work » Needs review

@jibus : I made code changes to fix the warnings.

Can you apply the patch - 3499387-MR12 and check if the issue is resolved and the change status to RTBC.

jibus’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, patch #7 fix the warning.

bhanu951’s picture

Title: Attempt to read property "sms" on array MigrateTfaUserSettings.php:98 » Fix warnings in MigrateTfaUserSettings class
Version: 1.0.4 » 1.x-dev

  • bhanu951 committed a8288ae7 on 1.x
    Issue #3499387: Fix warnings in MigrateTfaUserSettings class.
    
bhanu951’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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