- šŗšøUnited States aaronelborg
I think I fixed this by updating to the latest and greatest Paragraphs module. Does that sound familiar to anyone else?
- šØš¦Canada paintingguy
Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of core/lib/Drupal/Core/Database/Connection.php
Iām getting this when creating new registrations.
- šµš°Pakistan tahirpatel
It's not recommended to modify core files in Drupal. This can cause issues with future updates and maintenance of the site. Instead, you should create a patch file and add it to composer.
here are the steps to create a patch file and add it to composer:
Create a copy of the file Connection.php in the directory core/lib/Drupal/Core/Database to preserve the original file.
Edit the Connection.php file and replace the following code:
public function escapeLike($string) { return addcslashes($string, '\%_'); }
With:
public function escapeLike($string) { if (!isset($string)) { return $string; } return addcslashes($string, '\%_'); }
Navigate to the root directory of your Drupal installation in the terminal/command prompt.
Run the following command to create a patch file:
git diff > path/to/your/patch/file.patch
Replace path/to/your/patch/file.patch with the path where you want to save the patch file.
Open the composer.json file located in the root directory of your Drupal installation.
Add the following code to the extra section of the composer.json file:
"patches": { "drupal/core": { "EscapeLike function": "path/to/your/patch/file.patch" } }
Replace EscapeLike function with a short description of the patch, and path/to/your/patch/file.patch with the actual path where you saved the patch file.
Save the composer.json file and run the following command to apply the patch:
composer install
This will download the latest version of Drupal core and apply the patch automatically. If you have already installed Drupal core, you can run composer update instead of composer install.
That's it! The escapeLike() function will now return the original string if it is not set, and the patch will be applied automatically whenever you update or install Drupal core using composer.
- šµš°Pakistan tahirpatel
if patch not working you need to install 'cweagans/composer-patches'
The cweagans/composer-patches package is a Composer plugin that allows you to apply patches to third-party packages that you've installed via Composer.
To use this plugin, you can follow these steps:
Install the cweagans/composer-patches package via Composer:
composer require cweagans/composer-patches
Add the patch to your composer.json file:
{ "extra": { "patches": { "drupal/core": { "EscapeLike function fix": "patches/database-escapeLike.patch" } } } }
Run 'composer install' or 'composer update drupal/core' to apply the patch.
- šµš°Pakistan tahirpatel
if the patch not applies, you need to install composer 'cweagans/composer-patches'.
The cweagans/composer-patches package is a Composer plugin that allows you to apply patches to third-party packages that you've installed via Composer.
To use this plugin, you can follow these steps:
Install the cweagans/composer-patches package via Composer:
composer require cweagans/composer-patches
Add the patch to your composer.json file:
{ "extra": { "patches": { "drupal/core": { "EscapeLike function fix": "patches/database-escapeLike.patch" } } } }
Run
composer install
orcomposer update drupal/core
to apply the patch. - šµš°Pakistan tahirpatel
if the patch not applies, you need to install composer 'cweagans/composer-patches'.
The cweagans/composer-patches package is a Composer plugin that allows you to apply patches to third-party packages that you've installed via Composer.
To use this plugin, you can follow these steps:
Install the cweagans/composer-patches package via Composer:
composer require cweagans/composer-patches
Add the patch to your composer.json file:
{ "extra": { "patches": { "drupal/core": { "EscapeLike function fix": "patches/database-escapeLike.patch" } } } }
Run
composer install
orcomposer update drupal/core
to apply the patch.