Issue 1:
Q
A

Bug report?
yes

Feature request?
no

BC Break report?
yes/no ?

RFC?
no

Symfony version
3.2.10

Context:

symfony project v3.2

PHP 7

Mysql 5.7

Redis (for custom cache)

What happened:

after a composer update, Symfony did update from 3.2.9 to 3.2.10 (along with a known update from an owned module)

- Updating symfony/symfony (v3.2.9 => v3.2.10): Loading from cache
- Updating cleverage/process-bundle dev-master (6118651 => 4b264eb): Checking out 4b264eba8b

at the end of the composer update, a huge error happened

[2017-07-04 13:54:11] cache.WARNING: Failed to fetch key "%5BSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D" {"key":"%5BSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:179)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to save key "%5BSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D" (array) {"key":"%5BSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D","type":"array","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: array_keys() expects parameter 1 to be array, boolean given at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php:95)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to fetch key "%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D" {"key":"%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:179)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to save key "%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D" (integer) {"key":"%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CAbstractValue%5D%5B1%5D","type":"integer","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: array_keys() expects parameter 1 to be array, boolean given at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php:95)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to fetch key "%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D" {"key":"%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:179)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to fetch key "%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D" {"key":"%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:179)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to save key "%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D" (array) {"key":"%5BSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D","type":"array","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: array_keys() expects parameter 1 to be array, boolean given at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php:95)"}
[2017-07-04 13:54:11] cache.WARNING: Failed to fetch key "%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D" {"key":"%5B%5BC%5DSidus%5CEAVModelBundle%5CEntity%5CValueRepository%5D%5B1%5D","exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: Invalid argument supplied for foreach() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:179)"}
[...]

it can be reproduced with some doctrine commands (such as ./bin/console doctrine:schema:validate | head)

when reverting to v3.2.9, the bug disappear, all is normal ; when going back to v3.2.10 it fails again

reproduced on multiple environments (with mostly the same setup ; with and without docker)

cache clearing and restarting apache doesn't solve the thing

Issue 2:
Q
A

Bug report?
yes

Feature request?
no

BC Break report?
no

RFC?
no

Symfony version
3.4.x-dev

After:

$ git clone https://github.com/yceruto/symfony-standard -b cache_warmup_warning
$ cd symfony-standard
$ composer install --prefer-dist
$ bin/console c:c --no-warmup
$ bin/console c:w

Stacktrace:

...
01:22:05 WARNING [cache] Failed to save key "%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D" (array)
[
"key" => "%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D",
"type" => "array",
"exception" => Symfony\Component\Debug\Exception\ContextErrorException {
-context: [
"values" => [
"tN2hJq4bT3:%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D" => []
],
"lifetime" => 0
],
#message: "Warning: array_keys() expects parameter 1 to be array, boolean given",
#code: 0,
#file: "/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/ApcuTrait.php",
#line: 97,
#severity: E_WARNING,
trace: {
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/ApcuTrait.php:97: {
: try {,
: return array_keys(apcu_store($values, null, $lifetime));,
: } catch (\Error $e) {
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:216: {
: try {,
: $e = $this->doSave($values, $lifetime);,
: } catch (\Exception $e) {,
arguments: {
$values: [ …1],
$lifetime: 0
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:185: {
: ,
: return $this->commit();,
: }
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ChainAdapter.php:64: {
: ,
: $adapter->save($item);,
: $item->defaultLifetime = $origDefaultLifetime;,
arguments: {
$item: Symfony\Component\Cache\CacheItem {#1 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ChainAdapter.php:84: {
: while (0 <= --$i) {,
: $saveUp($this->adapters[$i], $item);,
: },
arguments: {
Symfony\Component\Cache\Adapter\ApcuAdapter { …},
Symfony\Component\Cache\CacheItem {#1 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php:40: {
: try {,
: $item = $this->pool->getItem($key);,
: } finally {,
arguments: {
$key: "%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php:91: {
: if (!isset($this->values[$key])) {,
: return $this->fallbackPool->getItem($key);,
: },
arguments: {
$key: "%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/DoctrineProvider.php:34: {
: {,
: $item = $this->pool->getItem(rawurlencode($id));,
: ,
arguments: {
$key: "%5BSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:78: {
: {,
: return $this->doFetch($this->getNamespacedId($id));,
: },
arguments: {
$id: "[Symfony\Component\Form\Form@[Annot]][1]"
}
},
/home/yceruto/bug/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:193: {
: $cacheKey = $rawCacheKey . self::$CACHE_SALT;,
: if (($data = $this->cache->fetch($cacheKey)) !== false) {,
: if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {,
arguments: {
$id: "Symfony\Component\Form\Form@[Annot]"
}
},
/home/yceruto/bug/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:82: {
: ,
: if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) {,
: $annots = $this->delegate->getClassAnnotations($class);,
arguments: {
$rawCacheKey: "Symfony\Component\Form\Form",
$class: ReflectionClass {#2 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php:48: {
: ,
: foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) {,
: if ($constraint instanceof GroupSequence) {,
arguments: {
$class: ReflectionClass {#2 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php:57: {
: foreach ($this->loaders as $loader) {,
: $success = $loader->loadClassMetadata($metadata) || $success;,
: },
arguments: {
$metadata: Symfony\Component\Validator\Mapping\ClassMetadata {#3 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:116: {
: if (null !== $this->loader) {,
: $this->loader->loadClassMetadata($metadata);,
: },
arguments: {
$metadata: Symfony\Component\Validator\Mapping\ClassMetadata {#3 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php:76: {
: if ($metadataFactory->hasMetadataFor($mappedClass)) {,
: $metadataFactory->getMetadataFor($mappedClass);,
: },
arguments: {
$value: "Symfony\Component\Form\Form"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48: {
: ,
: $warmer->warmUp($cacheDir);,
: },
arguments: {
$cacheDir: "/home/yceruto/bug/var/cache/dev"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php:68: {
: ,
: $warmer->warmUp($this->getContainer()->getParameter('kernel.cache_dir'));,
: ,
arguments: {
$cacheDir: "/home/yceruto/bug/var/cache/dev"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264: {
: } else {,
: $statusCode = $this->execute($input, $output);,
: },
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#4 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#5 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:887: {
: if ($event->commandShouldRun()) {,
: $exitCode = $command->run($input, $output);,
: } else {,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#4 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#5 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:223: {
: $this->runningCommand = $command;,
: $exitCode = $this->doRunCommand($command, $input, $output);,
: $this->runningCommand = null;,
arguments: {
$command: Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand { …},
$input: Symfony\Component\Console\Input\ArgvInput {#4 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#5 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:81: {
: ,
: return parent::doRun($input, $output);,
: },
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#4 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#5 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130: {
: $e = null;,
: $exitCode = $this->doRun($input, $output);,
: } catch (\Exception $x) {,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#4 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#5 …}
}
},
/home/yceruto/bug/bin/console:27: {
: $application = new Application($kernel);,
: $application->run($input);,
: ,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#4 …}
}
}
}
}
]
[]
01:22:05 WARNING [cache] Failed to fetch key "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
[
"key" => "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D",
"exception" => Symfony\Component\Debug\Exception\ContextErrorException {
-context: [
"key" => "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D",
"id" => "tN2hJq4bT3:%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D",
"f" => Closure {
class: "Symfony\Component\Cache\CacheItem",
parameters: {
$key: {},
$value: {},
$isHit: {}
},
use: {
$defaultLifetime: 0
},
file: "/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php",
line: "41 to 49"
},
"isHit" => false,
"value" => null
],
#message: "Warning: Invalid argument supplied for foreach()",
#code: 0,
#file: "/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php",
#line: 141,
#severity: E_WARNING,
trace: {
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php:141: {
: try {,
: foreach ($this->doFetch(array($id)) as $value) {,
: $isHit = true;
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/ChainAdapter.php:80: {
: foreach ($this->adapters as $i => $adapter) {,
: $item = $adapter->getItem($key);,
: ,
arguments: {
$key: "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php:40: {
: try {,
: $item = $this->pool->getItem($key);,
: } finally {,
arguments: {
$key: "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php:91: {
: if (!isset($this->values[$key])) {,
: return $this->fallbackPool->getItem($key);,
: },
arguments: {
$key: "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Cache/DoctrineProvider.php:34: {
: {,
: $item = $this->pool->getItem(rawurlencode($id));,
: ,
arguments: {
$key: "%5B%5BC%5DSymfony%5CComponent%5CForm%5CForm%40%5BAnnot%5D%5D%5B1%5D"
}
},
/home/yceruto/bug/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:78: {
: {,
: return $this->doFetch($this->getNamespacedId($id));,
: },
arguments: {
$id: "[[C]Symfony\Component\Form\Form@[Annot]][1]"
}
},
/home/yceruto/bug/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:233: {
: ,
: return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename);,
: },
arguments: {
$id: "[C]Symfony\Component\Form\Form@[Annot]"
}
},
/home/yceruto/bug/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:194: {
: if (($data = $this->cache->fetch($cacheKey)) !== false) {,
: if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) {,
: return $data;,
arguments: {
$cacheKey: "Symfony\Component\Form\Form@[Annot]",
$class: ReflectionClass {#1 …}
}
},
/home/yceruto/bug/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php:82: {
: ,
: if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) {,
: $annots = $this->delegate->getClassAnnotations($class);,
arguments: {
$rawCacheKey: "Symfony\Component\Form\Form",
$class: ReflectionClass {#1 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php:48: {
: ,
: foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) {,
: if ($constraint instanceof GroupSequence) {,
arguments: {
$class: ReflectionClass {#1 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php:57: {
: foreach ($this->loaders as $loader) {,
: $success = $loader->loadClassMetadata($metadata) || $success;,
: },
arguments: {
$metadata: Symfony\Component\Validator\Mapping\ClassMetadata {#2 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:116: {
: if (null !== $this->loader) {,
: $this->loader->loadClassMetadata($metadata);,
: },
arguments: {
$metadata: Symfony\Component\Validator\Mapping\ClassMetadata {#2 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php:76: {
: if ($metadataFactory->hasMetadataFor($mappedClass)) {,
: $metadataFactory->getMetadataFor($mappedClass);,
: },
arguments: {
$value: "Symfony\Component\Form\Form"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48: {
: ,
: $warmer->warmUp($cacheDir);,
: },
arguments: {
$cacheDir: "/home/yceruto/bug/var/cache/dev"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php:68: {
: ,
: $warmer->warmUp($this->getContainer()->getParameter('kernel.cache_dir'));,
: ,
arguments: {
$cacheDir: "/home/yceruto/bug/var/cache/dev"
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264: {
: } else {,
: $statusCode = $this->execute($input, $output);,
: },
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#3 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#4 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:887: {
: if ($event->commandShouldRun()) {,
: $exitCode = $command->run($input, $output);,
: } else {,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#3 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#4 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:223: {
: $this->runningCommand = $command;,
: $exitCode = $this->doRunCommand($command, $input, $output);,
: $this->runningCommand = null;,
arguments: {
$command: Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand { …},
$input: Symfony\Component\Console\Input\ArgvInput {#3 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#4 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:81: {
: ,
: return parent::doRun($input, $output);,
: },
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#3 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#4 …}
}
},
/home/yceruto/bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130: {
: $e = null;,
: $exitCode = $this->doRun($input, $output);,
: } catch (\Exception $x) {,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#3 …},
$output: Symfony\Component\Console\Output\ConsoleOutput {#4 …}
}
},
/home/yceruto/bug/bin/console:27: {
: $application = new Application($kernel);,
: $application->run($input);,
: ,
arguments: {
$input: Symfony\Component\Console\Input\ArgvInput {#3 …}
}
}
}
}
]
[]
...