Error: [] operator not supported for strings in restrict_by_ip.module

Created on 28 June 2021, almost 4 years ago
Updated 23 May 2025, 14 days ago

Problem/Motivation

It is my first time to report a problem. I hope I am doing it right. Any invalid input is causing the following error:

Error: [] operator not supported for strings in _restrict_by_ip_validate_ip() (line 580 of modules/restrict_by_ip/restrict_by_ip.module).

Steps to reproduce

1. Attempt to add a restriction by user.
2. Select the user
3. In the Allowed IP range enter an invalid ip address such as 168.192.0.1 This should normally trigger the error message: Illegal value for an IP Address. Each IP Address must be valid. Check IP Address 168.192.0.1.

Proposed resolution

Change error message from string to array as follows:

1. Change $ret = array('result' => TRUE, 'messages' => ''); to $ret = array('result' => TRUE, 'messages' => array());
2. Change $ret['messages'][] .= 'ERROR MESSAGE ...'; to $ret['messages'][] = "ERROR MESSAGE ... ";

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

3.1

Component

Code

Created by

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.

  • 🇦🇺Australia darvanen Sydney, Australia

    As Drupal 7 is no longer supported I am going to close this as outdated.

    Please feel free to re-open if you encounter this issue in the currently supported branch(es).

Production build 0.71.5 2024