Deprecated function: strpos(): Non-string needles will be interpreted as strings in the future

Created on 4 February 2023, about 2 years ago
Updated 8 February 2023, about 2 years ago

Problem/Motivation

When triggering a seed run through the UI, got this in the logs:

TYPE	php
DATE	Friday, February 3, 2023 - 20:47
USER	admin
LOCATION	https://quantdrupal7rc4.ddev.site/batch?id=7&op=do_nojs&op=do
REFERRER	https://quantdrupal7rc4.ddev.site/batch?op=start&id=7
MESSAGE	Deprecated function: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in quant_api_quant_seed_file() (line 311 of /var/www/html/sites/all/modules/contrib/quantcdn/modules/quant_api/quant_api.module).
SEVERITY	debug
HOSTNAME	
OPERATIONS	

Code with the issue:

  if (!empty($response->error) && strpos("MD5 already matches", $response->error) !== FALSE) {
    quant_log('Error sending request: %error', array(
      '%error' => $response->errorMsg,
    ), WATCHDOG_ERROR);
    return FALSE;
  }

Steps to reproduce

  • Install Drupal 7
  • Enable and configure quant_api module
  • Trigger seed of content
  • Look at logs
  • Result: Warnings about strpos deprecation
  • Expected result: No warnings about strpos deprecation
  • Proposed resolution

    Update the code to remove the deprecation.

    Remaining tasks

    1. Debug
    2. Update code
    3. Review and test
    4. Commit :)

    User interface changes

    API changes

    Data model changes

    πŸ› Bug report
    Status

    Fixed

    Version

    1.0

    Component

    Code

    Created by

    πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

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

    Comments & Activities

    Production build 0.71.5 2024