Deprecated function: addcslashes()

Created on 31 July 2023, over 1 year ago
Updated 6 October 2023, about 1 year ago

Problem/Motivation

1. Add Allow Only One field
2. Select Title as Unique field combinations
3. Use auto_entitylabel and auto create title.
4 Once created the node with the same title following issue :

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1294 of core\lib\Drupal\Core\Database\Connection.php).
Drupal\Core\Database\Connection->escapeLike(NULL) (Line: 431)
Drupal\Core\Database\Query\Select->escapeLike(NULL) (Line: 125)
Drupal\Core\Entity\Query\Sql\Condition::translateCondition(Array, Object, ) (Line: 70)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 176)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 81)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 154)
Drupal\allow_only_one\Plugin\Validation\Constraint\AllowOnlyOneConstraintValidator->getEntityMatches(Array, NULL, , 1, 'node', 'type', 'custom_select_list', 'nid') (Line: 69)
Drupal\allow_only_one\Plugin\Validation\Constraint\AllowOnlyOneConstraintValidator->validate(Object, Object) (Line: 202)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Object, '0000000000000af50000000000000000', Array) (Line: 154)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 485)
Drupal\Core\Entity\ContentEntityBase->validate() (Line: 188)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_custom_select_list_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('node_custom_select_list_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('node_custom_select_list_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
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: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇸🇰Slovakia coaston

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

Comments & Activities

  • Issue created by @coaston
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India keshavv India

    The issue is with the auto_entitylabel module. So I have added the condition to skip the validation if the module is enabled and configured into the given entity.
    Please review.
    Thank you.

  • 🇮🇳India keshavv India

    Adding patch.

  • 🇸🇰Slovakia coaston

    hi #keshav.k,
    First of all - thank you for your effort and help, much appreciated.

    However after I applied your patch it seems it does not validate at all and i can add as many duplicated values as I want. So it looks like once the auto_entitylabel is enabled it ignore validation at all.

  • 🇮🇳India keshavv India

    Hi, @coaston
    Thank you for verifying the issue.
    I have addressed your point and created a new patch for it.
    Please test and confirm.
    Thank you.

  • Status changed to Active about 1 year ago
  • 🇸🇰Slovakia coaston

    I am sorry for later response.

    I just tested your patch but not sure what should be the result. I can confirm there isn't any warning now, however when I select Title (Case Sensitive) the validation does not work so I can create the node with the same title again and again.

    Does this skip mean it won't use validation once title is auto-generated? Because In my case I need title to be valided, but also auto-generated :D

Production build 0.71.5 2024