Upgrading a Drupal site can be a smooth process when done correctly. However, it can introduce compatibility issues and break functionality if not handled properly. In this guide, we’ll cover the differences between patch, minor, and major releases, best practices for upgrading, and a real-world example where an update to Drupal 10.3.11 caused a PHP Fatal Error in the ECA module.
What we’ll cover
- Understand the difference between patch, minor, and major releases
- Real-World Example: PHP Fatal error in ECA module after upgrading to Drupal 10.3.11
- Best practices for upgrading Drupal
- Conclusion
Understand the difference between patch, minor, and major releases
Drupal follows Semantic Versioning (SemVer), which uses the format:
MAJOR.MINOR.PATH
For example, Drupal 10.3.11 consists of:
- 10 → Major version (significant changes, potential breaking updates)
- 3 → Minor version (new features, performance improvements, no breaking changes)
- 11 → Patch version (bug fixes, security patches, small enhancements)
1. Patch Releases (e.g., 10.3.11 → 10.3.12)
- What it includes: Security updates, bug fixes, and small performance tweaks.
- Does NOT introduce: New features or breaking changes.
-
When to update? Always update as soon as possible, especially for security patches.
2. Minor Releases (e.g., 10.3.11 → 10.4.0)
- What it includes: New features, UI improvements, and API enhancements.
- Does NOT introduce: Breaking changes, so existing modules/themes should continue to work.
- When to update? Regularly, after testing the update on a staging environment.
3. Major Releases (e.g., 10.3.11 → 11.0.0)
- What it includes: Major system overhauls, deprecated code removal, and significant feature changes.
- Can introduce: Breaking changes requiring updates to modules, themes, and custom code.
- When to update? Only after verifying compatibility, updating custom code, and thoroughly testing.
Real-World Example: PHP Fatal Error in ECA Module After Upgrading to Drupal 10.3.11
The issue
After upgrading to Drupal 10.3.11, the following fatal error occurred:
PHP Fatal error: Uncaught TypeError: Drupal\eca\EcaState::__construct():
Argument #2 ($time) must be of type Drupal\Component\Datetime\TimeInterface,
Drupal\Core\Cache\ChainedFastBackend given, called in
/app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261
and defined in /app/docroot/modules/contrib/eca/src/EcaState.php:34
Root Cause
The ECA module was not fully compatible with Drupal 10.3.11. The constructor of EcaState.php
expected TimeInterface, but a different service (ChainedFastBackend
) was injected due to changes in dependency handling in the new Drupal version.
Solution
To fix this issue:
- Clear Drupal’s cache:
drush cache:rebuild
- Check if an update is available for the ECA module:
composer outdated drupal/eca
- Update the ECA module:
composer update drupal/eca --with-dependencies
drush cache:rebuild
- If the issue persists, reinstall the module:
drush pm:uninstall eca -y
composer remove drupal/eca
composer require drupal/eca
drush cache:rebuild
Best practices for upgrading Drupal
1. Always Backup before upgrading
Before any update, create a full backup of your site:
drush sql-dump > backup.sql
rsync -avz sites/default/files backup/files
2. Test Updates on a staging environment
Never update directly on a live site. Instead:
- Clone your site to a staging server.
- Apply updates and test for issues.
- If everything works, deploy to production.
3. Check for Module & Theme Compatibility
Use composer to check outdated packages:
composer outdated drupal/*
4. Update in the right order
- Apply security updates first.
- Update Drupal core (minor updates).
- Update contributed modules and themes.
- Perform major upgrades only after compatibility checks.
5. Use Drush and Composer for efficient updates
Instead of updating manually, use:
composer update drupal/core-recommended drupal/core-dev --with-dependencies
After updating, clear caches:
drush cache:rebuild
6. Run Database and Configuration Updates
- Apply database updates:
drush updb -y
This updates the database schema after module or core updates.
- Export configuration changes:
drush cex -y
This ensures that all configuration changes are properly exported and version-controlled.
Conclusion
Understanding the difference between patch, minor, and major releases helps ensure smooth Drupal upgrades. Always test before updating, check module compatibility, and follow best practices to prevent unexpected issues like the ECA module’s fatal error. By following these steps, you can keep your Drupal site secure, stable, and up-to-date without downtime.