Jump to content

Recommended Posts

Posted

During the upgrade to version 4.6.10 the file... /system/Member/Member.php line 415 ... was updated with a change of logic to detect if the "memberSync" hook should be called.

Our extension relies on calls to this hook and we noticed after this upgrade that data stopped coming through. I believe the change in logic at this time was intended to stop updates when only the "last_activity" field had changed and nothing else, however the logic used now fails on ANY data with more than 1 value in the $changes array.

As a proof of concept I took the existing logic and tested it (this returns false, when it should return true)

$changedCustomFields = [];
$changes = [
    'a'=>1,
    'b'=>1
];
$res = ( \count( $changedCustomFields ) > 0 OR ( \count( $changes ) > 0 AND ( \count( $changes ) === 1 AND !isset( $changes['last_activity'] ) ) ) );

var_dump($res); // false

I think the following logic should work instead...

<?php

$changedCustomFields = [];
$changes = [
    'a' => 1,
    'b' => 1
];

$res = ( \count( $changedCustomFields ) > 0 OR ( \count( $changes ) > 0 AND !( \count( $changes ) === 1 AND isset( $changes['last_activity'] ) ) ) );

var_dump($res); // true

 

  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...