aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-04-23 10:47:35 +0200
committerMario Vavti <mario@mariovavti.com>2018-04-23 10:47:35 +0200
commitfedb5fbcf5bf2a5dcecc0ad6324775ccbedbf3d6 (patch)
tree32acf4c6df0421b1ab0d90a3671e3d950318e4b2
parentbb61e672b077a36d97f23972a1a6651f6904b741 (diff)
downloadvolse-hubzilla-fedb5fbcf5bf2a5dcecc0ad6324775ccbedbf3d6.tar.gz
volse-hubzilla-fedb5fbcf5bf2a5dcecc0ad6324775ccbedbf3d6.tar.bz2
volse-hubzilla-fedb5fbcf5bf2a5dcecc0ad6324775ccbedbf3d6.zip
update zot.php to fix php warning invalid argument supplied for foreach()
- this is taken from pr #1085 which was against wrong branch
-rw-r--r--include/zot.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/include/zot.php b/include/zot.php
index c2b622277..0343f4464 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3811,25 +3811,27 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
foreach($x as $y) {
// for each group, loop on members list we just received
- foreach($members[$y['hash']] as $member) {
- $found = false;
- $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1",
- intval($y['id']),
- intval($channel['channel_id']),
- dbesc($member)
- );
- if($z)
- $found = true;
-
- // if somebody is in the group that wasn't before - add them
-
- if(! $found) {
- q("INSERT INTO group_member (uid, gid, xchan)
- VALUES( %d, %d, '%s' ) ",
- intval($channel['channel_id']),
+ if(isset($y['hash']) && isset($members[$y['hash']])) {
+ foreach($members[$y['hash']] as $member) {
+ $found = false;
+ $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1",
intval($y['id']),
+ intval($channel['channel_id']),
dbesc($member)
);
+ if($z)
+ $found = true;
+
+ // if somebody is in the group that wasn't before - add them
+
+ if(! $found) {
+ q("INSERT INTO group_member (uid, gid, xchan)
+ VALUES( %d, %d, '%s' ) ",
+ intval($channel['channel_id']),
+ intval($y['id']),
+ dbesc($member)
+ );
+ }
}
}