Problem/Motivation
User gets the error below after saving a block containing empty link field:
Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1089 of core/lib/Drupal/Core/Database/Connection.php).
Drupal\Core\Database\Connection->escapeLike() (Line: 158)
Drupal\domain_path\DomainAliasRepository->lookupByAliasAndDomain() (Line: 39)
Drupal\domain_path\Plugin\Validation\Constraint\DomainPathUniqueConstraintValidator->validate() (Line: 231)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints() (Line: 172)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 190)
...Steps to reproduce
On a fresh Drupal 11.4.4 and domain_path 3.0.0
- Add at least one domain record: admin/config/domain
- Create a test block with at least one Link field
- Activate Layout builder to any Content Type
- Create a test node and try to add the test Block with empty link field
- The page is saved but huge warning is displayed
Proposed resolution
Early return if we have a empty alias
if (empty($value->alias)) ?? return;
Issue fork domain_path-3611433
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
igorgoncalves commentedComment #6
mably commentedHi @igorgoncalves, thanks for your MR.
Can you give a try to MR 123 and tell me if it fixes your problem?
Comment #8
igorgoncalves commentedHey @mably
Yes, the MR 123 fix also works on my project and the warning/error is gone.
thanks for you fast check on this one!
Comment #11
mably commentedThanks @igorgoncalves for your feedback, it's merged.