Make sure the values have correct types
[MAILPOET-2716]
This commit is contained in:
@@ -31,7 +31,7 @@ class MetadataCache extends CacheProvider {
|
|||||||
if (!$this->doContains($id)) {
|
if (!$this->doContains($id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return unserialize(file_get_contents($this->getFilename($id)));
|
return unserialize((string)file_get_contents($this->getFilename($id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function doContains($id) {
|
protected function doContains($id) {
|
||||||
@@ -40,7 +40,7 @@ class MetadataCache extends CacheProvider {
|
|||||||
|
|
||||||
// in dev mode invalidate cache if source file has changed
|
// in dev mode invalidate cache if source file has changed
|
||||||
if ($fileExists && $this->isDevMode) {
|
if ($fileExists && $this->isDevMode) {
|
||||||
$classMetadata = unserialize(file_get_contents($filename));
|
$classMetadata = unserialize((string)file_get_contents($filename));
|
||||||
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
||||||
try {
|
try {
|
||||||
$reflection = new ReflectionClass($classMetadata->name);
|
$reflection = new ReflectionClass($classMetadata->name);
|
||||||
@@ -48,7 +48,7 @@ class MetadataCache extends CacheProvider {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
return filemtime($filename) >= filemtime($reflection->getFileName());
|
return filemtime((string)$filename) >= filemtime((string)$reflection->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fileExists;
|
return $fileExists;
|
||||||
@@ -69,7 +69,11 @@ class MetadataCache extends CacheProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function doFlush() {
|
protected function doFlush() {
|
||||||
foreach (glob($this->directory . DIRECTORY_SEPARATOR . '*') as $filename) {
|
$directoryContent = glob($this->directory . DIRECTORY_SEPARATOR . '*');
|
||||||
|
if ($directoryContent === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach ($directoryContent as $filename) {
|
||||||
if (is_file($filename)) {
|
if (is_file($filename)) {
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user