Deprecated function: strpos() ... in Drupal\blazy\BlazyManagerBase->preSettings() (line 220)

Created on 4 March 2025, about 1 month ago

Warning in log:
Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\blazy\BlazyManagerBase->preSettings() (line 220 of /web/modules/contrib/blazy/src/BlazyManagerBase.php)

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇺🇦Ukraine Skymen

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

Comments & Activities

  • Issue created by @Skymen
  • 🇮🇩Indonesia gausarts

    Good find, thank you.

    Please provide the repro, what pages you see it, and also the entire error message.

    Once provided, you may want to wrap $route_name line as a condition instead.

  • 🇺🇦Ukraine Skymen

    This warning appears on log when microsoft bot from IP 52.167.144.17 scan my site. The target page is article with images.
    In one minute more than 300 lines in dblog. If users are visited this page, the log is empty.

    Error trace:

    Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\blazy\BlazyManagerBase->preSettings() (line 220 of /home/www40/sites/promini.info/web/modules/contrib/blazy/src/BlazyManagerBase.php)
    #0 /home/www40/sites/promini.info/web/core/includes/bootstrap.inc(108): _drupal_error_handler_real()
    #1 [internal function]: _drupal_error_handler()
    #2 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/BlazyManagerBase.php(220): strpos()
    #3 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/Utility/Check.php(175): Drupal\blazy\BlazyManagerBase->preSettings()
    #4 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/BlazyManagerBase.php(115): Drupal\blazy\Utility\Check::blazyOrNot()
    #5 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/BlazyManager.php(394): Drupal\blazy\BlazyManagerBase->isBlazy()
    #6 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/BlazyManager.php(121): Drupal\blazy\BlazyManager->getBlazySettings()
    #7 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/Plugin/Field/FieldFormatter/BlazyFormatterViewTrait.php(73): Drupal\blazy\BlazyManager->build()
    #8 /home/www40/sites/promini.info/web/modules/contrib/blazy/src/Plugin/Field/FieldFormatter/BlazyFileFormatterBase.php(153): Drupal\blazy\Plugin\Field\FieldFormatter\BlazyFileFormatterBase->commonViewElements()
    #9 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Field/FormatterBase.php(91): Drupal\blazy\Plugin\Field\FieldFormatter\BlazyFileFormatterBase->viewElements()
    #10 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php(83): Drupal\Core\Field\FormatterBase->view()
    #11 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(275): Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase->view()
    #12 /home/www40/sites/promini.info/web/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(286): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
    #13 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(340): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple()
    #14 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
    #15 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
    #16 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
    #17 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(107): call_user_func_array()
    #18 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(825): Drupal\Core\Render\Renderer->doTrustedCallback()
    #19 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(387): Drupal\Core\Render\Renderer->doCallback()
    #20 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(203): Drupal\Core\Render\Renderer->doRender()
    #21 /home/www40/sites/promini.info/web/core/modules/media/src/Plugin/Filter/MediaEmbed.php(390): Drupal\Core\Render\Renderer->render()
    #22 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\media\Plugin\Filter\MediaEmbed->Drupal\media\Plugin\Filter\{closure}()
    #23 /home/www40/sites/promini.info/web/core/modules/media/src/Plugin/Filter/MediaEmbed.php(389): Drupal\Core\Render\Renderer->executeInRenderContext()
    #24 /home/www40/sites/promini.info/web/core/modules/media/src/Plugin/Filter/MediaEmbed.php(342): Drupal\media\Plugin\Filter\MediaEmbed->renderIntoDomNode()
    #25 /home/www40/sites/promini.info/web/core/modules/filter/src/Element/ProcessedText.php(123): Drupal\media\Plugin\Filter\MediaEmbed->process()
    #26 [internal function]: Drupal\filter\Element\ProcessedText::preRenderText()
    #27 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(107): call_user_func_array()
    #28 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(825): Drupal\Core\Render\Renderer->doTrustedCallback()
    #29 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(387): Drupal\Core\Render\Renderer->doCallback()
    #30 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(203): Drupal\Core\Render\Renderer->doRender()
    #31 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #32 /home/www40/sites/promini.info/web/files/php/twig/67c628c749b30_field.html.twig_FSjFgIK9PW3dJUR_sgCOseq1j/IVLKhaAvf-riZELmwqQj6H0_mRFm1atvpJaDKCcxSvU.php(72): Drupal\Core\Template\TwigExtension->escapeFilter()
    #33 /home/www40/sites/promini.info/vendor/twig/twig/src/Template.php(388): __TwigTemplate_bf4174f3261ffef1f2bfa4b6e261f181->doDisplay()
    #34 /home/www40/sites/promini.info/vendor/twig/twig/src/Template.php(344): Twig\Template->yield()
    #35 /home/www40/sites/promini.info/vendor/twig/twig/src/Template.php(359): Twig\Template->display()
    #36 /home/www40/sites/promini.info/vendor/twig/twig/src/TemplateWrapper.php(51): Twig\Template->render()
    #37 /home/www40/sites/promini.info/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #38 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #39 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Theme\ThemeManager->render()
    #40 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(459): Drupal\Core\Render\Renderer->doRender()
    #41 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(203): Drupal\Core\Render\Renderer->doRender()
    #42 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(120): Drupal\Core\Render\Renderer->render()
    #43 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
    #44 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Render/Renderer.php(119): Drupal\Core\Render\Renderer->executeInRenderContext()
    #45 /home/www40/sites/promini.info/web/core/modules/node/src/Plugin/Search/NodeSearch.php(526): Drupal\Core\Render\Renderer->renderInIsolation()
    #46 /home/www40/sites/promini.info/web/core/modules/node/src/Plugin/Search/NodeSearch.php(490): Drupal\node\Plugin\Search\NodeSearch->indexNode()
    #47 /home/www40/sites/promini.info/web/core/modules/search/src/Hook/SearchHooks.php(100): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
    #48 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Cron.php(275): Drupal\search\Hook\SearchHooks->cron()
    #49 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(307): Drupal\Core\Cron->Drupal\Core\{closure}()
    #50 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Cron.php(258): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    #51 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/Cron.php(97): Drupal\Core\Cron->invokeCronHandlers()
    #52 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
    #53 /home/www40/sites/promini.info/web/core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php(65): Drupal\Core\ProxyClass\Cron->run()
    #54 /home/www40/sites/promini.info/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate()
    #55 /home/www40/sites/promini.info/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
    #56 /home/www40/sites/promini.info/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
    #57 /home/www40/sites/promini.info/vendor/symfony/http-kernel/HttpKernel.php(114): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
    #58 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(63): Symfony\Component\HttpKernel\HttpKernel->terminate()
    #59 /home/www40/sites/promini.info/web/core/lib/Drupal/Core/DrupalKernel.php(683): Drupal\Core\StackMiddleware\StackedHttpKernel->terminate()
    #60 /home/www40/sites/promini.info/web/index.php(22): Drupal\Core\DrupalKernel->terminate()
    #61 {main}

  • 🇮🇩Indonesia gausarts

    Wondering why bots would bypass human visitors.

    Please clarify, did you enable caching at performance page?

  • 🇮🇩Indonesia gausarts

    I am not a bot expert, however years ago, I created a PHP bot which consumed Envanto sites in scheduled and targetted batches, stored the results in DB, and displayed the texts after minor grammar and word spins along with images and videos directly in my own site. I also created a Python bot which consumed sites but dumped the text into JSON files instead along with images and archive files for further PHP processing. I also created a Java bot helped with JavaScript to render dynamic JS sites, stored the texts in SQLite inside an Android app, and displayed the texts, images, podcast files and videos directly in the app.

    These bots are good when I know the sites' structures. When I don't, I can also use httrack, wget or a proprietary bot software.

    These six bots I had worked with have one thing in common -- they only deal with dead HTML, and static files, even when they were initially dynamic like JS or PHP sites, etc.

    However, I am open to learning about Microsoft bots which sounded to directly consume or read dynamic PHP per se, if any further explanation as requested in the previous comment.

    Feel free to re-open. Or alternatively use robots.txt to block useless bots.

Production build 0.71.5 2024