Problem/Motivation
SitePrivateKeyFileKeyProviderDecorator::getKeyValue() calls dirname($this->fileSystem->realpath($path)). realpath() returns FALSE when the private key file is missing, so dirname(false) throws a TypeError on PHP 8. Any page running easy_encryption_requirements() (e.g. /admin/config) then fatals.
TypeError: dirname(): Argument #1 ($path) must be of type string, false given (line 67 of SitePrivateKeyFileKeyProviderDecorator.php)
A second TypeError follows: parent::getKeyValue() can return NULL against the : string return type.
Steps to reproduce
- Have an easy_encrypted key whose private key file is missing on this environment.
- Visit
/admin/config. - WSOD / TypeError.
Not a duplicate of #3575553
#3575553 (fixed, 1.0.0-rc6, in 1.0.3) fixed key generation: writePrivateKeyToFile() now creates the directory. This is the read path — getKeyValue() still calls dirname(realpath()) unguarded in 1.0.3.
Proposed resolution
Guard realpath() !== FALSE before dirname(), and return ?? '' from the parent delegations. MR to follow.
AI usage
AI-Generated: Yes (Used Claude Code to draft the issue summary and the proposed fix; reviewed and verified by the contributor.)
Issue fork easy_encryption-3605529
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 #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahComment #6
rajab natshahComment #7
rajab natshahComment #9
mxr576Comment #11
mxr576Thanks for finding this and also providing a fix. I have made minor optimizations on the code before I merged it, please double check if 1.0.x-dev has the proper fix.
I'll release a tagged version later this week.
Comment #13
mxr576Everything looks okay with the merged change? I assume it does so a tagged release could go out today.