Kdyby / DoctrineCache

Doctrine 2 Cache integration into Nette Framework
https://packagist.org/packages/kdyby/doctrine-cache
Other
10 stars 21 forks source link

Fix $lifeTime condition in Cache::doSave #18

Closed davidkrmela closed 6 years ago

davidkrmela commented 6 years ago

$lifeTime=NULL probably should has same behaviour as $lifeTime=0 in Cache::doSave. This change match condition with official Filesystem cache: https://github.com/doctrine/cache/blob/v1.7.1/lib/Doctrine/Common/Cache/FilesystemCache.php#L102

Otherwise caching of ClassMetadata is broken and data is never cached. ClassMetadataFactory use $lifeTime=NULL with meaning expire=never: https://github.com/doctrine/common/blob/v2.8.1/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php#L221

enumag commented 6 years ago

$lifeTime is not supposed to be null, it should always be integer. Send a PR to Doctrine.

enumag commented 6 years ago

I sent the PR to Doctrine but I'll merge this anyway as a hotfix and for compatibility with older versions of Doctrine.