Warning: Illegal string offset 'appears' in spambot_sfs_request()

Created on 26 December 2020, almost 4 years ago
Updated 12 February 2024, 9 months ago

Caching ( #1894452: caching data locally ) is broken:

      if (!empty($data['email'])) {
        foreach ($data['email'] as $data_email) {
          $expire_email = $data_email['appears'] ? $expire : $expire_false;
          cache_set("email:{$data_email['value']}", $data_email, 'cache_spambot', $expire_email);
        }
      }
      if (!empty($data['username'])) {
        foreach ($data['username'] as $data_username) {
          $expire_username = $data_username['appears'] ? $expire : $expire_false;
          cache_set("username:{$query['username']}", $data_username, 'cache_spambot', $expire_username);
        }
      }
      if (!empty($data['ip'])) {
        $expire_ip = $data['ip']['appears'] ? $expire : $expire_false;
        cache_set("ip:{$query['ip']}", $data['ip'], 'cache_spambot', $expire_ip);
      }

The structure for 'email' and 'username' is the same as for 'ip'. The foreach's are wrong.

The meaning of $expire vs. $expire_false is unclear and there's no explanation -- it's unclear whether 'ip' is doing the right thing...

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇭Switzerland salvis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024