symfony: [Cache] Failed to save key of type array
Symfony version(s) affected
5.4.0-BETA3
Description
When testing SF 5.4, the following warning occurs on entities with Assert
annotations and PhpFilesAdapter
cache.
Failed to save key "App%5CEntity%5CPartner%24name" of type array: Cache key "App%5CEntity%5CPartner%24name" has non-serializable "array" value.
How to reproduce
class Partner
{
/**
* @var int
*
* @ORM\Column(name="id_partner", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $idPartner;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=50)
* @Assert\NotBlank
* @Assert\Length(
* min=2,
* max=50,
* minMessage="partner.name.min_size",
* maxMessage="partner.name.max_size"
* )
*/
private $name;
...
}
Possible Solution
No response
Additional Context
[
"key" => "App%5CEntity%5CPartner%24name"
"exception" => Symfony\Component\Cache\Exception\InvalidArgumentException {#3436 ▼
#message: "Cache key "App%5CEntity%5CPartner%24name" has non-serializable "array" value."
#code: 0
#file: "/var/www/morningcroissant/symfony/vendor/symfony/cache/Adapter/PhpFilesAdapter.php"
#line: 229
-previous: ErrorException {#3429 …}
trace: {▶}
}
"cache-adapter" => "Symfony\Component\Cache\Adapter\PhpFilesAdapter"
]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (23 by maintainers)
OK, I now am able to reproduce. I need to run
bin/console c:c --no-warmup
before refreshing the browser.@nicolas-grekas could it be related to https://github.com/symfony/symfony/commit/aa4fb0c2c4c3a5ef135ea671c7c6cd03ece56d9e#diff-eadef5e494fbfb85346e70992f4b18994df0b999b7d336c9cece5ab9e9a4a18a unsetting the property ?
Same with this, no issue: PHP 7.3.31-2+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Oct 22 2021 12:34:45) ( NTS )