Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ a release.
---

## [Unreleased]
### Fixed
- SoftDeleteable: Remove dollar sign ($) from the default cache key of soft deleteable metadata - to be compatible with stricter cache key naming conventions (see https://www.php-fig.org/psr/psr-6/#definitions) (#2978)
Copy link
Collaborator

@phansys phansys Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the provided description and the referenced definition, I can't see this change as a fix.
The PSR-6 spec about cache keys states the following:

Key - A string of at least one character that uniquely identifies a cached item. Implementing libraries MUST support keys consisting of the characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding and a length of up to 64 characters. Implementing libraries MAY support additional characters and encodings or longer lengths, but must support at least that minimum.

This does not mean that characters other than A-Z, a-z, 0-9, _, and . are not allowed or discouraged. It confirms that at least these must be supported as minimum.

However, even if the current choice of characters in this library complies with the PSR-6 spec but causes a problem, the Fixed section MUST explicitly and clearly state what problem this change is fixing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phansys
Should I link the Laminas File cache's pattern here?
https://github.com/laminas/laminas-cache-storage-adapter-filesystem/blob/3.2.x/src/FilesystemOptions.php#L26
This was the reason of the whole PR.

In my opinion if PSR6 says about what is the most strict standard, and this library follows this, it can be a fix, but it's your decision of course.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my take on the changelog entry. It's not a fix per se as it's not directly fixing a bug, so let's call it a change. Also note it doesn't affect only SoftDeleteable as this is changing the base EMF class all extensions use.

### Changed
- All: Removed the dollar sign from the generated cache ID for extension metadata to ensure only characters mandated by PSR-6 are used, improving compatibility with caching implementations with strict character requirements (#2978)

FWIW, doctrine/persistence originally used $CLASSMETADATA as its cache salt in the class metadata factory when the doctrine/cache library was used. It changed to the current __CLASSMETADATA__ value in doctrine/persistence#144 when support for PSR-6 was added and support for the Doctrine Cache library was deprecated. There isn't any explanation in that PR why the salt changed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your proposal @mbabker.

@adambalint-srg, could you please rebase the PR and update the changelog according this suggestion?


## [3.21.0] - 2025-09-22
### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/ExtensionMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function getExtensionMetadata($meta)
*/
public static function getCacheId($className, $extensionNamespace)
{
return str_replace('\\', '_', $className).'_$'.strtoupper(str_replace('\\', '_', $extensionNamespace)).'_CLASSMETADATA';
return str_replace('\\', '_', $className).'__'.strtoupper(str_replace('\\', '_', $extensionNamespace)).'_CLASSMETADATA';
}

/**
Expand Down