llaville / php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions
https://llaville.github.io/php-compatinfo-db/6.13/
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

`psr/cache` compatibility #101

Closed llaville closed 2 years ago

llaville commented 2 years ago

Bug report

PHP 8.1 platform GA run (i.e: https://github.com/llaville/php-compatinfo-db/runs/4568927123?check_suite_focus=true) did not work with psr/cache 2.0.0 installed

OS

Host operating system and version: GitHub Actions Workflow

Dependencies

  - Installing seld/jsonlint (1.8.3): Extracting archive
  - Installing react/promise (v2.8.0): Extracting archive
  - Installing psr/log (1.1.4): Extracting archive
  - Installing justinrainbow/json-schema (5.2.11): Extracting archive
  - Installing composer/pcre (1.0.0): Extracting archive
  - Installing composer/xdebug-handler (2.0.3): Extracting archive
  - Installing composer/spdx-licenses (1.5.6): Extracting archive
  - Installing composer/semver (3.2.6): Extracting archive
  - Installing composer/metadata-minifier (1.0.0): Extracting archive
  - Installing composer/ca-bundle (1.3.1): Extracting archive
  - Installing composer/composer (2.1.14): Extracting archive
  - Installing symfony/polyfill-php72 (v1.23.0): Extracting archive
  - Installing psr/cache (2.0.0): Extracting archive
  - Installing doctrine/event-manager (1.1.1): Extracting archive
  - Installing doctrine/deprecations (v0.5.3): Extracting archive
  - Installing doctrine/collections (1.6.8): Extracting archive
  - Installing doctrine/cache (2.1.1): Extracting archive
  - Installing doctrine/lexer (1.2.1): Extracting archive
  - Installing doctrine/annotations (1.13.2): Extracting archive
  - Installing doctrine/persistence (2.2.3): Extracting archive
  - Installing doctrine/instantiator (1.4.0): Extracting archive
  - Installing doctrine/inflector (2.0.4): Extracting archive
  - Installing doctrine/dbal (3.2.0): Extracting archive
  - Installing doctrine/common (3.2.0): Extracting archive
  - Installing doctrine/orm (2.10.3): Extracting archive
  - Installing symfony/messenger (v5.4.0): Extracting archive
  - Installing symfony/redis-messenger (v6.0.1): Extracting archive
  - Installing symfony/doctrine-messenger (v6.0.1): Extracting archive
  - Installing symfony/amqp-messenger (v6.0.1): Extracting archive
  - Installing symfony/var-exporter (v6.0.0): Extracting archive
  - Installing symfony/cache-contracts (v2.5.0): Extracting archive
  - Installing symfony/cache (v5.4.0): Extracting archive
  - Installing symfony/polyfill-php81 (v1.23.0): Extracting archive
  - Installing symfony/config (v5.4.0): Extracting archive
  - Installing symfony/dependency-injection (v5.4.1): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.0.0): Extracting archive
  - Installing symfony/event-dispatcher (v5.4.0): Extracting archive
  - Installing symfony/phpunit-bridge (v5.4.0): Extracting archive
  - Installing symfony/requirements-checker (v2.0.1): Extracting archive
  - Installing symfony/stopwatch (v5.4.0): Extracting archive

Other information

Read the psr/cache CHANGELOG v2.0

  • BREAKING The CacheItemInterface::expiresAt() method’s $expiration parameter is typehinted with DateTimeInterface, see this explanation

And source code : https://github.com/php-fig/cache/blob/2.0.0/src/CacheItemInterface.php#L89

llaville commented 2 years ago

Works locally with psr/cache 2.0

devilbox@php-8.1.1 in /shared/backups/bartlett/php-compatinfo-db $ php -v
PHP 8.1.1 (cli) (built: Dec 18 2021 01:11:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
devilbox@php-8.1.1 in /shared/backups/bartlett/php-compatinfo-db $ composer show
composer/ca-bundle                   1.3.1     Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/composer                    2.1.14    Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the rig...
composer/metadata-minifier           1.0.0     Small utility library that handles metadata minification and expansion.
composer/package-versions-deprecated 1.11.99.4 Composer plugin that provides efficient querying for installed package versions (no runtime IO)
composer/pcre                        1.0.0     PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                      3.2.6     Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses               1.5.6     SPDX licenses list and validation library.
composer/xdebug-handler              2.0.3     Restarts a process without Xdebug.
doctrine/annotations                 1.13.2    Docblock Annotations Parser
doctrine/cache                       2.1.1     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such a...
doctrine/collections                 1.6.8     PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                      3.2.0     PHP Doctrine Common project is a library that provides additional functionality that other Doctrine proj...
doctrine/dbal                        3.2.0     Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and ...
doctrine/deprecations                v0.5.3    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all de...
doctrine/event-manager               1.1.1     The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctr...
doctrine/inflector                   2.0.4     PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/low...
doctrine/instantiator                1.4.0     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       1.2.1     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         2.10.3    Object-Relational-Mapper for PHP
doctrine/persistence                 2.2.3     The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doct...
justinrainbow/json-schema            5.2.11    A library to validate a json schema.
psr/cache                            2.0.0     Common interface for caching libraries
psr/container                        1.1.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                 1.0.0     Standard interfaces for event handling.
psr/log                              1.1.4     Common interface for logging libraries
react/promise                        v2.8.0    A lightweight implementation of CommonJS Promises/A for PHP
seld/jsonlint                        1.8.3     JSON Linter
seld/phar-utils                      1.2.0     PHAR file format utilities, for when PHP phars you up
symfony/amqp-messenger               v6.0.1    Symfony AMQP extension Messenger Bridge
symfony/cache                        v5.4.0    Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts              v2.5.0    Generic abstractions related to caching
symfony/config                       v5.4.0    Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                      v5.4.1    Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection         v5.4.1    Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts        v3.0.0    A generic function and convention to trigger deprecation notices
symfony/doctrine-messenger           v6.0.1    Symfony Doctrine Messenger Bridge
symfony/event-dispatcher             v5.4.0    Provides tools that allow your application components to communicate with each other by dispatching even...
symfony/event-dispatcher-contracts   v3.0.0    Generic abstractions related to dispatching event
symfony/filesystem                   v6.0.0    Provides basic utilities for the filesystem
symfony/finder                       v5.4.0    Finds files and directories via an intuitive fluent interface
symfony/messenger                    v5.4.0    Helps applications send and receive messages to/from other applications or via message queues
symfony/phpunit-bridge               v5.4.0    Provides utilities for PHPUnit, especially user deprecation notices management
symfony/polyfill-ctype               v1.23.0   Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme       v1.23.1   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer     v1.23.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring            v1.23.1   Symfony polyfill for the Mbstring extension
symfony/polyfill-php72               v1.23.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73               v1.23.0   Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80               v1.23.1   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81               v1.23.0   Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process                      v5.4.0    Executes commands in sub-processes
symfony/redis-messenger              v6.0.1    Symfony Redis extension Messenger Bridge
symfony/requirements-checker         v2.0.1    Check Symfony requirements and give recommendations
symfony/service-contracts            v2.4.1    Generic abstractions related to writing services
symfony/stopwatch                    v5.4.0    Provides a way to profile code
symfony/string                       v6.0.1    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters...
symfony/var-exporter                 v6.0.0    Allows exporting any serializable PHP data structure to plain PHP code
llaville commented 2 years ago

Issue did not come from psr/cache version, but from memcached that raise a TypoError on PHP 8.1

PHP Fatal error:  Uncaught TypeError: Memcached::setMulti(): Argument #2 ($expiration) must be of type int, int given in /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/cache/Adapter/MemcachedAdapter.php:261
Stack trace:
#0 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/cache/Adapter/MemcachedAdapter.php(261): Memcached->setMulti()
#1 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/cache/Adapter/AbstractAdapter.php(162): Symfony\Component\Cache\Adapter\MemcachedAdapter->doSave()
#2 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/cache/Traits/AbstractAdapterTrait.php(273): Symfony\Component\Cache\Adapter\AbstractAdapter->commit()
#3 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php(93): Symfony\Component\Cache\Adapter\AbstractAdapter->save()
#4 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php(115): Doctrine\Common\Cache\Psr6\DoctrineProvider->doSave()
#5 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php(235): Doctrine\Common\Cache\CacheProvider->save()
#6 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php(267): Doctrine\Common\Cache\Psr6\CacheAdapter->commit()
#7 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php(147): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()
#8 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/AbstractCommand.php(39): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata()
#9 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/console/Command/Command.php(298): Doctrine\ORM\Tools\Console\Command\SchemaTool\AbstractCommand->execute()
#10 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/console/Application.php(1005): Symfony\Component\Console\Command\Command->run()
#11 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#12 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#13 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php(48): Symfony\Component\Console\Application->run()
#14 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/orm/bin/doctrine.php(52): Doctrine\ORM\Tools\Console\ConsoleRunner::run()
#15 /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/doctrine/orm/bin/doctrine(4): include('...')
#16 {main}
  thrown in /home/runner/work/php-compatinfo-db/php-compatinfo-db/vendor/symfony/cache/Adapter/MemcachedAdapter.php on line 261

Already identified and referenced at https://github.com/php-memcached-dev/php-memcached/issues/484

llaville commented 2 years ago

When we try to create Doctrine ORM schema, the tool used the cache strategy as defined at https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Tools/Setup.php#L165-L191

  1. Memory first if dev mode activated
  2. Memcached
  3. Redis
llaville commented 2 years ago

APP_ENV = dev for CI solved definitivly this issue. See commit https://github.com/llaville/php-compatinfo-db/commit/0a4d10c02784c38720f3ed27928cae9689f29fcf and CI run https://github.com/llaville/php-compatinfo-db/actions/runs/1598244489