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

Wrong Implementation psr-16 #1049

Closed
dusta opened this issue Jul 2, 2019 · 3 comments
Closed

Wrong Implementation psr-16 #1049

dusta opened this issue Jul 2, 2019 · 3 comments
Labels

Comments

@dusta
Copy link

dusta commented Jul 2, 2019

This is:

- [*] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

Error:
Fatal error: Uncaught TypeError: Argument 1 passed to Driver::deleteItems() must be of the type array, object given, called in Psr16Adapter.php on line 178 and defined in lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php:297

What is the expected behavior?

must be of the type array,

What is the current behavior?

Object given

What are the steps to reproduce?

Set cache adapter

<?php

\PhpOffice\PhpSpreadsheet\Settings::setCache($Psr16Adapter);
@dusta dusta changed the title Wrong Implementation psr 16 Wrong Implementation psr-16 Jul 2, 2019
@PowerKiKi
Copy link
Member

This is not PhpSpreadsheet code, you are referencing code from another library. File a bug with that other library.

@dusta
Copy link
Author

dusta commented Jul 26, 2019

@PowerKiKi I show example how to reproduce error.

https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/memory_saving.md

$cache = new MyCustomPsr16Implementation();
\PhpOffice\PhpSpreadsheet\Settings::setCache($cache);

This not compatible with PSR-16

@PowerKiKi
Copy link
Member

Those two lines of code have nothing to do with PSR-16. And they tell me nothing useful for PhpSpreadsheet. The implementation of MyCustomPsr16Implementation is incorrect/buggy, not PhpSpreadsheet.

Your lib incorrectly type hint array:

https://github.com/PHPSocialNetwork/phpfastcache/blob/5f12dab09b888383db754d941f2953cb4c876011/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php#L297

But the PSR-16 specification clearly allow an iterable, not only an array:

https://github.com/php-fig/simple-cache/blob/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b/src/CacheInterface.php#L88

Again there is nothing wrong with PhpSpreadsheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants