The PSR specification does not list hyphens as necessarily accepted in cache keys. Trying to use many of the common libraries (such as cache/filesystem-adapter) causes an error due to the use of hyphens in the cache key.
System informations
(In case of a bug report Please complete the table below)
Information
Description
Pdp version
5.1.0
PHP version
7.1
OS Platform
Mac
Standalone code, or other way to reproduce the problem
composer require cache/filesystem-adapter
<?php
include("vendor/autoload.php");
$hostname = "https://foo.example.com";
$filesystemAdapter = new \League\Flysystem\Adapter\Local(__DIR__."./");
$filesystem = new \League\Flysystem\Filesystem($filesystemAdapter);
$cacheInterface = new \Cache\Adapter\Filesystem\FilesystemCachePool($filesystem);
$client = new class implements \Pdp\HttpClient {
public function getContent(string $url): string
{
return file_get_contents($url);
}
};
$manager = new \Pdp\Manager($cacheInterface, $client);
$rules = $manager->getRules();
$domain = $rules->resolve($hostname);
var_dump($domain->getRegistrableDomain());
Expected result
string(11) "example.com"
Actual result
PHP Fatal error: Uncaught Cache\Adapter\Common\Exception\InvalidArgumentException: Invalid key "PSL-FULL-5a3cc7f81795bb2e48e848af42d287b4". Valid filenames must match [a-zA-Z0-9_\.! ]. in .../vendor/cache/filesystem-adapter/FilesystemCachePool.php:145
Issue summary
The PSR specification does not list hyphens as necessarily accepted in cache keys. Trying to use many of the common libraries (such as
cache/filesystem-adapter
) causes an error due to the use of hyphens in the cache key.System informations
(In case of a bug report Please complete the table below)
Standalone code, or other way to reproduce the problem
composer require cache/filesystem-adapter
Expected result
Actual result