Skip to content

Fatal error when using ComposerFinder with the Symfony Cache Component #13

@llaville

Description

@llaville

Hello @alekitto

I've just discover your package with recent major release 7.0 of GraphQLite

I've tried it on my new package still under development (and not yet published) that use the Symfony Cache Component, and got finding class issue.

Here is how to reproduce :

A simple composer.json with such contents

{
    "require": {
        "symfony/cache": "^6.4 || ^7.0",
        "kcs/class-finder": "^0.4.0"
    }
}

The script to reproduce error

<?php

require_once 'vendor/autoload.php';

use Kcs\ClassFinder\Finder\ComposerFinder;

$finder = new ComposerFinder();
//$finder->notPath('vendor/symfony/cache');

$count = 0;
foreach ($finder as $className => $reflector) {
    printf('- %s '. PHP_EOL, $className);
    ++$count;
}
printf('> found %d class(es)' . PHP_EOL, $count);

There is a strange entry - � in class list on results above

find results
- Composer\InstalledVersions
- Safe\DateTime
- Safe\DateTimeImmutable
- Safe\Exceptions\ApacheException
- Safe\Exceptions\ApcException
- Safe\Exceptions\ApcuException
- Safe\Exceptions\ArrayException
- Safe\Exceptions\Bzip2Exception
- Safe\Exceptions\CalendarException
- Safe\Exceptions\ClassobjException
- Safe\Exceptions\ComException
- Safe\Exceptions\CubridException
- Safe\Exceptions\CurlException
- Safe\Exceptions\DatetimeException
- Safe\Exceptions\DirException
- Safe\Exceptions\EioException
- Safe\Exceptions\ErrorfuncException
- Safe\Exceptions\ExecException
- Safe\Exceptions\FileinfoException
- Safe\Exceptions\FilesystemException
- Safe\Exceptions\FilterException
- Safe\Exceptions\FpmException
- Safe\Exceptions\FtpException
- Safe\Exceptions\FunchandException
- Safe\Exceptions\GettextException
- Safe\Exceptions\GmpException
- Safe\Exceptions\GnupgException
- Safe\Exceptions\HashException
- Safe\Exceptions\IbaseException
- Safe\Exceptions\IbmDb2Exception
- Safe\Exceptions\IconvException
- Safe\Exceptions\ImageException
- Safe\Exceptions\ImapException
- Safe\Exceptions\InfoException
- Safe\Exceptions\InotifyException
- Safe\Exceptions\JsonException
- Safe\Exceptions\LdapException
- Safe\Exceptions\LibeventException
- Safe\Exceptions\LibxmlException
- Safe\Exceptions\LzfException
- Safe\Exceptions\MailparseException
- Safe\Exceptions\MbstringException
- Safe\Exceptions\MiscException
- Safe\Exceptions\MssqlException
- Safe\Exceptions\MysqlException
- Safe\Exceptions\MysqliException
- Safe\Exceptions\NetworkException
- Safe\Exceptions\Oci8Exception
- Safe\Exceptions\OpcacheException
- Safe\Exceptions\OpensslException
- Safe\Exceptions\OutcontrolException
- Safe\Exceptions\PasswordException
- Safe\Exceptions\PcntlException
- Safe\Exceptions\PcreException
- Safe\Exceptions\PgsqlException
- Safe\Exceptions\PosixException
- Safe\Exceptions\PsException
- Safe\Exceptions\PspellException
- Safe\Exceptions\ReadlineException
- Safe\Exceptions\RpminfoException
- Safe\Exceptions\RrdException
- Safe\Exceptions\SafeExceptionInterface
- Safe\Exceptions\SemException
- Safe\Exceptions\SessionException
- Safe\Exceptions\ShmopException
- Safe\Exceptions\SimplexmlException
- Safe\Exceptions\SocketsException
- Safe\Exceptions\SodiumException
- Safe\Exceptions\SolrException
- Safe\Exceptions\SplException
- Safe\Exceptions\SqlsrvException
- Safe\Exceptions\SsdeepException
- Safe\Exceptions\Ssh2Exception
- Safe\Exceptions\StatsException
- Safe\Exceptions\StreamException
- Safe\Exceptions\StringsException
- Safe\Exceptions\SwooleException
- Safe\Exceptions\UodbcException
- Safe\Exceptions\UopzException
- Safe\Exceptions\UrlException
- Safe\Exceptions\VarException
- Safe\Exceptions\XdiffException
- Safe\Exceptions\XmlException
- Safe\Exceptions\XmlrpcException
- Safe\Exceptions\YamlException
- Safe\Exceptions\YazException
- Safe\Exceptions\ZipException
- Safe\Exceptions\ZlibException
- �
- Symfony\Contracts\Service\Attribute\SubscribedService
- Symfony\Contracts\Service\Attribute\Required
- Symfony\Contracts\Service\ResetInterface
- Symfony\Contracts\Service\ServiceLocatorTrait
- Symfony\Contracts\Service\ServiceProviderInterface
- Symfony\Contracts\Service\ServiceSubscriberInterface
- Symfony\Contracts\Service\ServiceSubscriberTrait
- Symfony\Contracts\Cache\CacheInterface
- Symfony\Contracts\Cache\CacheTrait
- Symfony\Contracts\Cache\CallbackInterface
- Symfony\Contracts\Cache\ItemInterface
- Symfony\Contracts\Cache\TagAwareCacheInterface
- Symfony\Component\VarExporter\Exception\NotInstantiableTypeException
- Symfony\Component\VarExporter\Exception\LogicException
- Symfony\Component\VarExporter\Exception\ClassNotFoundException
- Symfony\Component\VarExporter\Exception\ExceptionInterface
- Symfony\Component\VarExporter\Hydrator
- Symfony\Component\VarExporter\Instantiator
- Symfony\Component\VarExporter\Internal\LazyObjectTrait
- Symfony\Component\VarExporter\Internal\LazyObjectRegistry
- Symfony\Component\VarExporter\Internal\LazyObjectState
- Symfony\Component\VarExporter\Internal\Reference
- Symfony\Component\VarExporter\Internal\Hydrator
- Symfony\Component\VarExporter\Internal\Registry
- Symfony\Component\VarExporter\Internal\Values
- Symfony\Component\VarExporter\Internal\Exporter
- Symfony\Component\VarExporter\LazyGhostTrait
- Symfony\Component\VarExporter\LazyObjectInterface
- Symfony\Component\VarExporter\LazyProxyTrait
- Symfony\Component\VarExporter\ProxyHelper
- Symfony\Component\VarExporter\VarExporter
- Symfony\Component\Cache\Adapter\NullAdapter
- Symfony\Component\Cache\Adapter\ProxyAdapter
- Symfony\Component\Cache\Adapter\DoctrineDbalAdapter
- Symfony\Component\Cache\Adapter\AbstractAdapter
- Symfony\Component\Cache\Adapter\TagAwareAdapterInterface
- Symfony\Component\Cache\Adapter\MemcachedAdapter
- Symfony\Component\Cache\Adapter\ArrayAdapter
- Symfony\Component\Cache\Adapter\Psr16Adapter
- Symfony\Component\Cache\Adapter\AdapterInterface
- Symfony\Component\Cache\Adapter\ParameterNormalizer
- Symfony\Component\Cache\Adapter\PhpFilesAdapter
- Symfony\Component\Cache\Adapter\FilesystemAdapter
- Symfony\Component\Cache\Adapter\TagAwareAdapter
- Symfony\Component\Cache\Adapter\RedisTagAwareAdapter
- Symfony\Component\Cache\Adapter\AbstractTagAwareAdapter
- Symfony\Component\Cache\Adapter\ChainAdapter
- Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter
- Symfony\Component\Cache\Adapter\PdoAdapter
- Symfony\Component\Cache\Adapter\ApcuAdapter
- Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter
- Symfony\Component\Cache\Adapter\TraceableAdapter
- Symfony\Component\Cache\Adapter\PhpArrayAdapter
- Symfony\Component\Cache\Adapter\RedisAdapter
- Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter
- Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter
- Symfony\Component\Cache\CacheItem
- Symfony\Component\Cache\Exception\LogicException
- Symfony\Component\Cache\Exception\InvalidArgumentException
- Symfony\Component\Cache\Exception\CacheException
- Symfony\Component\Cache\LockRegistry
- Symfony\Component\Cache\Marshaller\TagAwareMarshaller
- Symfony\Component\Cache\Marshaller\DefaultMarshaller
- Symfony\Component\Cache\Marshaller\SodiumMarshaller
- Symfony\Component\Cache\Marshaller\MarshallerInterface
- Symfony\Component\Cache\Marshaller\DeflateMarshaller
- Symfony\Component\Cache\Messenger\EarlyExpirationMessage
- Symfony\Component\Cache\Messenger\EarlyExpirationDispatcher
- Symfony\Component\Cache\Messenger\EarlyExpirationHandler
- Symfony\Component\Cache\PruneableInterface
- Symfony\Component\Cache\ResettableInterface
- Symfony\Component\Cache\Traits\ContractsTrait
- Symfony\Component\Cache\Traits\RedisClusterProxy
- Symfony\Component\Cache\Traits\FilesystemTrait
- Symfony\Component\Cache\Traits\Redis6Proxy

Fatal error: Declaration of Symfony\Component\Cache\Traits\Redis5Proxy::_compress($value) must be compatible with Redis::_compress(string $value): string in /shared/backups/github/class-finder-issues/vendor/symfony/cache/Traits/Redis5Proxy.php on line 64

Call Stack:
    0.0002     697600   1. {main}() /shared/backups/github/class-finder-issues/find.php:0
    0.0661    8288544   2. Kcs\ClassFinder\Iterator\ClassIterator->next() /shared/backups/github/class-finder-issues/find.php:16
    0.0661    8288544   3. Generator->next() /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/ClassIterator.php:60
    0.0661    8288544   4. Kcs\ClassFinder\Iterator\ClassIterator->next() /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/ComposerIterator.php:81
    0.0661    8288544   5. Generator->next() /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/ClassIterator.php:60
    0.0661    8288544   6. Kcs\ClassFinder\Iterator\Psr4Iterator->getGenerator() /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/ClassIterator.php:60
    0.0661    8288624   7. Kcs\ClassFinder\Iterator\{closure:/shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/Psr4Iterator.php:59-61}($path = '/shared/backups/github/class-finder-issues/vendor/symfony/cache/Traits/Redis5Proxy.php') /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/Psr4Iterator.php:96
    0.0671    8630960   8. include_once('/shared/backups/github/class-finder-issues/vendor/symfony/cache/Traits/Redis5Proxy.php') /shared/backups/github/class-finder-issues/vendor/kcs/class-finder/lib/Iterator/Psr4Iterator.php:60

NOTE no workaround seems possible (even with notPath)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions