stristr(): Passing null to parameter #1 ($haystack) of type string is deprecated in AMPService::isDevPage()

Created on 24 April 2023, over 2 years ago

Problem/Motivation

There is a deprecation message that happens when there is no query string. This is being triggered from our Behat tests.

Here's a excerpt of a stack trace.

    ╳  PHP Errors were logged:
    ╳  <em class="placeholder">Deprecated function</em>: stristr(): Passing null to parameter #1 ($haystack) of type string is deprecated in <em class="placeholder">Drupal\amp\Service\AMPService-&gt;isDevPage()</em> (line <em class="placeholder">173</em> of <em class="placeholder">/opt/drupal/web/modules/contrib/amp/src/Service/AMPService.php</em>) #0 /opt/drupal/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(8192, &#039;stristr(): Pass...&#039;, &#039;/opt/drupal/web...&#039;, 173)
    ╳  #1 [internal function]: _drupal_error_handler(8192, &#039;stristr(): Pass...&#039;, &#039;/opt/drupal/web...&#039;, 173)
    ╳  #2 /opt/drupal/web/modules/contrib/amp/src/Service/AMPService.php(173): stristr(NULL, &#039;debug&#039;)
    ╳  #3 /opt/drupal/web/modules/contrib/amp/amp.module(83): Drupal\amp\Service\AMPService-&gt;isDevPage()
    ╳  #4 /opt/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(315): amp_page_attachments(Array)
    ╳  #5 /opt/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}(Object(Closure), &#039;amp&#039;)
🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

e0ipso Can Picafort

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

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

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024