Skip to content

using file cache result in invalid key error #354

@bobonov

Description

@bobonov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions