PHP warning Warning: Undefined array key 1 in soundcloudfield_field_formatter_view()

Created on 8 September 2022, almost 2 years ago
Updated 2 November 2023, 8 months ago

Problem/Motivation

I just updated my site to PHP8, and I'm now seeing the following PHP warnings:

Warning: Undefined array key 1 in soundcloudfield_field_formatter_view() (line 456 of drupal/sites/all/modules/contrib/soundcloudfield/soundcloudfield.module).
Warning: Trying to access array offset on value of type null in soundcloudfield_field_formatter_view() (line 447 of drupal/sites/all/modules/contrib/soundcloudfield/soundcloudfield.module).
🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇺🇸United States jenlampton

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

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.

  • 🇺🇸United States vinmassaro

    @jenlampton: We are seeing this on Pantheon but not related to PHP 8.x. Are you by any chance seeing this happen on Pantheon-hosted sites?

    Soundcloud is blocking requests to the oEmbed endpoint and the error in the original post is because the code assumes a JSON response. If you output the value of $soundcloud_curl_get on line 442 of soundcloudfield.module, you will probably see similar output to what is below. I suspect Soundcloud is blocking Pantheon outbound IPs because of too many connections from customer sites from the same outbound IP addresses. It looks like others are reporting issues too: https://github.com/soundcloud/api/issues/247

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <TITLE>ERROR: The request could not be satisfied</TITLE>
    </HEAD><BODY>
    <H1>403 ERROR</H1>
    <H2>The request could not be satisfied.</H2>
    <HR noshade size="1px">
    Request blocked.
    We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
    <BR clear="all">
    If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
    <BR clear="all">
    <HR noshade size="1px">
    <PRE>
    Generated by cloudfront (CloudFront)
    Request ID: 3KV8GgFUVhFSN4h-1sdzy1Ic8lkgbzlbr7St4zdcIrYGDCnAPBLcrQ==
    </PRE>
    <ADDRESS>
    </ADDRESS>
    </BODY></HTML>
  • 🇮🇳India dineshkumarbollu

    The patch #3 looks empty, created patch for this please review.

Production build 0.69.0 2024