Problem/Motivation

On /admin/config/system/mailer page
I get this error

Deprecated function: strnatcasecmp(): Passing null to parameter #1 ($string1) of type string is deprecated in Drupal\symfony_mailer\Entity\MailerPolicy::sort() (line 362 of modules/contrib/symfony_mailer/src/Entity/MailerPolicy.php).
Drupal\symfony_mailer\Entity\MailerPolicy::sort(Object, Object)
uasort(Array, Array) (Line: 24)
Drupal\Core\Config\Entity\ConfigEntityListBuilder->load() (Line: 69)
Drupal\symfony_mailer\MailerPolicyListBuilder->load() (Line: 218)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('mailer_policy')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 159)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 130)
Drupal\cdn\StackMiddleware\DuplicateContentPreventionMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 symfony_mailer.warning.3315562-4.patch482 bytesadamps

Comments

trickfun created an issue. See original summary.

adamps’s picture

Thanks probably the cause is MailerPolicy::getEntityLabel() which can return NULL. We could change it to return ''. Patches welcome.

It's hard to hit this problem. It would need two policies with the same type and sub-type plus has_entity is FALSE (for at least one of them - but they are the same type, so will share this value). However in that case they are both the same policy.

Ah maybe you have two policies of different unknown types - so they are different policy but the same label.

trickfun’s picture

I had 2 unknow sub-type
deleted it fix the problem
thank you

adamps’s picture

Status: Active » Needs review
StatusFileSize
new482 bytes
juancec’s picture

Assigned: Unassigned » juancec

Hi, I'll review it.

juancec’s picture

Assigned: juancec » Unassigned

Hi @AdamPS, I couldn't reproduce the error, so I couldn't test the patch #4. I'm sorry.

  • AdamPS committed 5dc1f5d on 1.x
    Issue #3315562 by AdamPS: Deprecated function strnatcasecmp
    
adamps’s picture

Status: Needs review » Fixed

No problem - it is tricky to reproduce as it requires a specific unusual condition. I hit the condition myself yesterday so I fixed it😃.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.