Invalid placeholder php error when checking if an account matches a known spammer

Created on 28 June 2022, over 2 years ago
Updated 13 March 2023, almost 2 years ago

When using the option available from the Spam tab on user profiles to check if the user is a known spammer, you may receive the following error in Watchdog if the user's IP matches:

User warning: Invalid placeholder (!ip) with string: "An IP address !ip used by this account matches %num times." in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 241 of /public_html/core/lib/Drupal/Component/Render/FormattableMarkup.php)
#0 /public_html/core/includes/bootstrap.inc(347): _drupal_error_handler_real(512, 'Invalid placeho...', '/...', 241)
#1 [internal function]: _drupal_error_handler(512, 'Invalid placeho...', '/...', 241)
#2 /public_html/core/lib/Drupal/Component/Render/FormattableMarkup.php(241): trigger_error('Invalid placeho...', 512)
#3 /public_html/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat('An IP address !...', Array)
#4 /public_html/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#5 /public_html/core/lib/Drupal/Core/Messenger/Messenger.php(54): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#6 /public_html/modules/contrib/spambot/src/Form/SpambotUserspamForm.php(408): Drupal\Core\Messenger\Messenger->addMessage(Object(Drupal\Core\StringTranslation\TranslatableMarkup), 'warning')
#7 /public_html/modules/contrib/spambot/src/Form/SpambotUserspamForm.php(305): Drupal\spambot\Form\SpambotUserspamForm->checkSubmit(Object(Drupal\user\Entity\User), Object(Drupal\Core\Config\ImmutableConfig))
#8 [internal function]: Drupal\spambot\Form\SpambotUserspamForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#9 /public_html/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
#10 /public_html/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#11 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(592): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#12 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('spambot_user_sp...', Array, Object(Drupal\Core\Form\FormState))
#13 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(219): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\spambot\\...', Object(Drupal\Core\Form\FormState))
#14 /public_html/modules/contrib/spambot/src/Controller/SpambotUserSpamPageController.php(23): Drupal\Core\Form\FormBuilder->getForm('Drupal\\spambot\\...', Object(Drupal\user\Entity\User))
#15 [internal function]: Drupal\spambot\Controller\SpambotUserSpamPageController->spambotUserSpam(Object(Drupal\user\Entity\User))
#16 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#17 /public_html/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#19 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#20 /vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#22 /public_html/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(46): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\redirect_after_login\RedirectMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /public_html/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(320): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /public_html/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#34 {main}

1. Navigate to a user account.
2. Go to the Spam tab.
3. Click on the โ€œCheck if this account matches a known spammerโ€ button.

If the resulting report comes back with IP matches, you should find the above message in Watchdog.

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom Janner

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.

Production build 0.71.5 2024