Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using file cache result in invalid key error #354

Closed
bobonov opened this issue Feb 1, 2018 · 0 comments
Closed

using file cache result in invalid key error #354

bobonov opened this issue Feb 1, 2018 · 0 comments

Comments

@bobonov
Copy link

bobonov commented Feb 1, 2018

What is the expected behavior?

Using php-cache/filesystem-adapter should work

What is the current behavior?

An error for invalid key is geenrated

PHP Fatal error: Uncaught Cache\Adapter\Common\Exception\InvalidArgumentException: Invalid key "phpspreadsheet-5a72ef3fb5bbe5.20523748-A1". Valid filenames must match [a-zA-Z0-9_.! ]. in /var/www/commissioni.yiib/vendor/cache/filesystem-adapter/FilesystemCachePool.php:145

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php
require __DIR__ . '/vendor/autoload.php';
$filesystemAdapter = new League\Flysystem\Adapter\Local('/tmp/');
$filesystem = new League\Flysystem\Filesystem($filesystemAdapter);
$pool = new Cache\Adapter\Filesystem\FilesystemCachePool($filesystem);
$pool->setFolder('cache');
$simpleCache = new Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);

PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache);

$reader = new PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load('test.xlsx');
$dataImport=$spreadsheet->getActiveSheet()->toArray();
var_dump($dataImport);

Which versions of PhpSpreadsheet and PHP are affected?

PHP 7.1
phpoffice/phpspreadsheet 1.1.0
cache/adapter-common 1.0.0
cache/filesystem-adapter 1.0.0
cache/simple-cache-bridge 1.0.0

Dfred pushed a commit to Dfred/PhpSpreadsheet that referenced this issue Nov 20, 2018
Ensure compatibility with all PSR-16 cache implementation by using
a stricter character set for cache key that match the spec.

Fixes PHPOffice#354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant