<!-- THEME DEBUG -->
<!-- THEME HOOK: 'field' -->
<!-- FILE NAME SUGGESTIONS:
   ▪️ field--node--title--article.html.twig
   ✅ field--node--title.html.twig
   ▪️ field--node--article.html.twig
   ▪️ field--title.html.twig
   ▪️ field--string.html.twig
   ▪️ field.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/contrib/classy/templates/field/field--node--title.html.twig' -->
<span class=D10 Upgrades Common Problems and Solutions ">

D10 Upgrades Common Problems and Solutions

D10 Upgrades from Drupal 9 can be tricky! There are usually unforeseen issues. Here are some commonly seen problems and solutions. 

The best place to find steps on how to upgrade: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site

Common Recurring Problems Solution
Dependency problems - some modules are not d10 compatible

The Drupal Lenient package can be first installed and then used to ignore dependency problems. But this is only a temporary fix, and the modules should then be upgraded after the d10 switch.

composer require mglaman/composer-drupal-lenient composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/token"]'


The lenient composer package allows these modules to be patched. It ignores their composer conflicts in order to be patched.

Often modules will have to be removed from composer WHILE the d10 switch is happening, then they can be re-added. This is akin to a surgeon working on a patient, the patient is the site, and the patient should be put under during the switch.

If your base theme, (like for example,  classy) is no longer in core, but your theme depends on it?  Add classy (or any theme that your custom theme is dependent on)  to composer.
capcha is d10 only Add captcha to lenient list or use the OR logic in composer.json: "drupal/captcha": "^1.0 || ^2.0"
ckeditor 5 is now in core remember to configure it for all text editors after the upgrade
better_exposed_filters and jquery modules

better_exposed_filters depends on jquery but the module hasn't been updated to depend on the NEW d10 version of jquery. Solution is to point to the FORKED module's git repo instead of the drupal.org one. To do this, make sure you have the lenient package installed, then add the following to your composer.json: 

{ "type": "vcs", "url": "https://git.drupalcode.org/issue/better_exposed_filters-3317774" },

 

"drupal/better_exposed_filters": "dev-6.0.x",

 

"drupal-lenient": { "allowed-list": ["drupal/better_exposed_filters"] }

Custom theme folders often contain the old once references. Search your theme folder for all instances of once and replace.  Search for .once(

https://www.drupal.org/node/3158256

https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-from-drupal-9-to-drupal-10-0/migrating-dependencies-on-core-jquery-ui-libraries

https://www.drupal.org/node/3067969

fix according to drupal.org. example:
//First add the once library as a parameter

-    (function ($, Drupal) {
+    (function ($, Drupal, once) {

//then inside the function, change the actual code

-    var $slideshowSlides = $('.field--name-field-slideshow-slides');
 
-    $slideshowSlides.once('initSlideshow').each(function() {
+    $(once('initSlideshow', '.field--name-field-slideshow-slides')).each(function() {
+

// then add the parameter afterward

-    })(jQuery, Drupal);
+    })(jQuery, Drupal, once);

Don't forget to add it to your libraries file, and rebuild your front-end!

# mymodule.libraries.yml
myfeature:
js:
js/myfeature.js: {}
dependencies:
- core/drupal
- core/once
Parameter $event of method Drupal\custom_module\EventSubscriber\ResponseSubscriber::handle() has typehint with deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead replace dependency where needed AFTER d10 upgrade, will break D9

#drupal-off-canvas is deprecated

https://www.drupal.org/node/3305664

replace with #drupal-off-canvas-wrapper (don't forget to rebuild your front end!)
Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not

add ->accessCheck(TRUE) to your entityQuery

https://stefvanlooveren.me/blog/entityquery-access-check-will-be-enforced-drupal-10

Ckeditor4 is deprecated but still required by some modules. Leave in composer.json but uninstall.

render error

https://stefvanlooveren.me/errors/how-fix-call-deprecated-function-render-drupal-9

//example
$output = render($build);
$output = \Drupal::service('renderer')->render($build);
rowCount error - Drupal\Core\Database\RowCountException: rowCount() is supported for DELETE, INSERT, or UPDATE statements

example of how to fix:
//before
$query = $this->database->select('comment_field_data', 'c')
->fields('c', ['field_name', 'uid'])
->condition('uid', $this->user->id())
->condition('entity_id', $entity_id)
->condition('field_name', $field_name)
->condition('entity_type', $entity_type)
->execute();
$query->allowRowCount = TRUE;
return $query->rowCount();


//after

return $this->database->select('comment_field_data', 'c')
->fields('c', ['field_name', 'uid'])
->condition('uid', $this->user->id())
->condition('entity_id', $entity_id)
->condition('field_name', $field_name)
->condition('entity_type', $entity_type)
->countQuery()
->execute()
->fetchField();

https://git.drupalcode.org/project/comment_limit/-/commit/66bd415fe7abb37f7b81297d7540e6fd1cf63716

PHPStan command failed: This error shows up when using the upgrade_status module This can be ignored. Happens when there are no php files to test. https://www.drupal.org/project/upgrade_status/issues/3354706

Deprecated twig usage

https://www.drupal.org/node/3071078

Use filters referenced in this link.

file_create_url() is deprecated

https://stefvanlooveren.me/errors/how-fix-call-deprecated-function-filecreateurl-drupal-9-10

//before 

file_create_url($uri)

//after

\Drupal::service('file_url_generator')->generateAbsoluteString($uri)

internal class extension error

https://drupal.stackexchange.com/questions/287378/extending-core-classes-with-the-internal-tag

either change your code to not extend internal classes, or write some behat tests to ensure your code won't break!

If a module is only compatible with D10

https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-from-drupal-9-to-drupal-10/overview

Use the OR logic in the composer.json: "drupal/remove_http_headers": "^1.0" to "drupal/remove_http_headers": "^1.0 || ^2.0"