llaville / php-compatinfo

Library that find out the minimum version and the extensions required for a piece of code to run
https://llaville.github.io/php-compatinfo/7.1/
Other
371 stars 21 forks source link

Multiple conditions not displayed #301

Closed llaville closed 3 years ago

llaville commented 3 years ago

Bug report

OS

1. Host operating system and version: Ubuntu 18.04 LTS, Docker version 20.10.2, build 2291f61, Windows 20H2 (WSL2) 2. PHP version: 7.2.34 3. PHP CompatInfo version: 5.5.1 and 6.0.x-dev with DB version 3.4.2 4. What git commit hash are you on?: 5. PHP extensions loaded? Uses either reference:list or db:list command depends on CompatInfo version:

Reference Database Version => 3.4.2

 Reference      Version  State  Release Date Loaded
 amqp           1.10.2   stable 2020-04-05   1.10.2
 apc            3.1.13   beta   2012-09-03
 apcu           5.1.20   stable 2021-03-04   5.1.20
 ast            1.0.10   stable 2020-09-12   1.0.10
 bcmath         8.0.3    stable 2021-03-04   7.2.34
 bz2            8.0.3    stable 2021-03-04   7.2.34
 calendar       8.0.3    stable 2021-03-04   7.2.34
 core           8.0.3    stable 2021-03-04   7.2.34
 ctype          8.0.3    stable 2021-03-04   7.2.34
 curl           8.0.3    stable 2021-03-04   7.2.34
 date           8.0.3    stable 2021-03-04   7.2.34
 dom            8.0.3    stable 2021-03-04   20031129
 enchant        8.0.3    stable 2021-03-04   7.2.34
 ereg           4.0.1    stable 2000-06-28
 exif           8.0.3    stable 2021-03-04   7.2.34
 fileinfo       8.0.3    stable 2021-03-04   1.0.5
 filter         8.0.3    stable 2021-03-04   7.2.34
 ftp            8.0.3    stable 2021-03-04   7.2.34
 gd             8.0.3    stable 2021-03-04   7.2.34
 gender         1.1.0    stable 2015-02-03
 geoip          1.1.1    beta   2016-08-19
 gettext        8.0.3    stable 2021-03-04   7.2.34
 gmp            8.0.3    stable 2021-03-04   7.2.34
 haru           1.0.4    stable 2012-12-23
 hash           8.0.3    stable 2021-03-04   1.0
 htscanner      1.0.1    stable 2012-03-01
 http           4.0.0    stable 2021-01-13   3.2.4
 iconv          8.0.3    stable 2021-03-04   7.2.34
 igbinary       3.2.1    stable 2020-12-27   3.2.1
 imagick        3.4.4    stable 2019-05-02   3.4.4
 imap           8.0.3    stable 2021-03-04   7.2.34
 inclued        0.1.3    beta   2012-06-12
 intl           8.0.3    stable 2021-03-04   1.1.0
 jsmin          3.0.0    stable 2018-01-23   3.0.0
 json           8.0.3    stable 2021-03-04   1.6.0
 ldap           8.0.3    stable 2021-03-04   7.2.34
 libevent       0.1.0    beta   2013-05-22
 libxml         8.0.3    stable 2021-03-04   7.2.34
 lzf            1.6.8    stable 2020-04-16   1.6.8
 mailparse      3.1.1    stable 2020-09-16   3.1.1
 mbstring       8.0.3    stable 2021-03-04   7.2.34
 mcrypt         4.0.7    stable 2021-03-16   7.2.34
 memcache       8.0      stable 2020-12-06   4.0.5.2
 memcached      3.1.5    stable 2019-12-03   3.1.5
 mhash          4.0.4    stable 2000-12-19
 mongo          1.6.16   stable 2017-09-05
 msgpack        2.1.2    stable 2020-11-27   2.1.2
 mssql          5.5.2    stable 2013-08-13
 mysql          5.2.3    stable 2007-05-31
 mysqli         8.0.3    stable 2021-03-04   7.2.34
 oauth          2.0.7    stable 2020-09-18   2.0.7
 oci8           3.0.1    stable 2020-12-20   2.2.0
 odbc           8.0.3    stable 2021-03-04
 opcache        8.0.3    stable 2021-03-04
 openssl        8.0.3    stable 2021-03-04   7.2.34
 pcntl          8.0.3    stable 2021-03-04   7.2.34
 pcre           8.0.3    stable 2021-03-04   7.2.34
 pdflib         4.1.4    stable 2019-12-18
 pdo            8.0.3    stable 2021-03-04   7.2.34
 pgsql          8.0.3    stable 2021-03-04
 phar           8.0.3    stable 2021-03-04   2.0.2
 posix          8.0.3    stable 2021-03-04   7.2.34
 pthreads       3.1.6    stable 2016-02-13
 raphf          2.0.1    stable 2019-10-25   2.0.1
 rar            4.2.0    stable 2020-12-06   4.2.0
 readline       8.0.3    stable 2021-03-04   7.2.34
 recode         4.0.0    stable 2000-05-22   7.2.34
 redis          5.3.3    stable 2021-02-01   5.3.3
 reflection     8.0.3    stable 2021-03-04   7.2.34
 riak           1.2.0    stable 2014-05-15
 session        8.0.3    stable 2021-03-04   7.2.34
 shmop          8.0.3    stable 2021-03-04   7.2.34
 simplexml      8.0.3    stable 2021-03-04   7.2.34
 snmp           8.0.3    stable 2021-03-04   0.1
 soap           8.0.3    stable 2021-03-04   7.2.34
 sockets        8.0.3    stable 2021-03-04   7.2.34
 solr           2.5.1    stable 2019-09-09   2.5.1
 sphinx         1.3.3    stable 2015-05-21
 spl            8.0.3    stable 2021-03-04   7.2.34
 sqlite         2.0-dev  stable 2004-07-13
 sqlite3        8.0.3    stable 2021-03-04   7.2.34
 ssh2           1.3.1    beta   2021-03-02   1.2
 standard       8.0.3    stable 2021-03-04   7.2.34
 stomp          2.0.2    stable 2018-06-29
 svn            2.0.3    beta   2019-12-16
 sync           1.1.1    stable 2017-02-20
 sysvmsg        8.0.3    stable 2021-03-04   7.2.34
 sysvsem        8.0.3    stable 2021-03-04   7.2.34
 sysvshm        8.0.3    stable 2021-03-04   7.2.34
 tidy           8.0.3    stable 2021-03-04   7.2.34
 tokenizer      8.0.3    stable 2021-03-04   7.2.34
 uopz           6.1.2    stable 2020-06-30
 uploadprogress 1.1.3    stable 2020-01-28   1.1.3
 varnish        1.2.4    stable 2018-07-01
 wddx           4.0.0    stable 2000-05-22
 xcache         3.2.0    stable 2014-09-18
 xdebug         3.0.3    stable 2021-02-22   3.0.3
 xhprof         2.2.3    stable 2020-11-27   2.2.3
 xml            8.0.3    stable 2021-03-04   7.2.34
 xmldiff        1.1.3    stable 2021-01-17   1.1.3
 xmlreader      8.0.3    stable 2021-03-04   7.2.34
 xmlrpc         1.0.0RC2 beta   2021-01-15   7.2.34
 xmlwriter      8.0.3    stable 2021-03-04   7.2.34
 xsl            8.0.3    stable 2021-03-04   7.2.34
 yac            2.3.0    stable 2021-01-06   2.3.0
 yaml           2.2.1    stable 2020-12-20   2.2.1
 zip            1.19.2   stable 2020-11-23   1.15.4
 zlib           8.0.3    stable 2021-03-04   7.2.34
 Total          [108]                        [81]

Summary

When parsing a data source with multiple code conditions, only the first one is display in analyser report. i.e: when data source is https://github.com/symfony/polyfill/tree/main/src/Php80

Expected behaviour

Functions Analysis

    Function            REF      EXT min/Max PHP min/Max
    class_implements    spl      5.1.0       5.1.0
    defined             core     4.0.0       4.0.0
 C  fdiv                standard 8.0.0alpha1 8.0.0alpha1
    function_exists     core     4.0.0       4.0.0
    get_class           core     4.0.0       4.0.0
 C  get_debug_type      standard 8.0.0alpha1 8.0.0alpha1
    get_parent_class    core     4.0.0       4.0.0
 C  get_resource_id     core     8.0.0alpha1 8.0.0alpha1
    get_resource_type   core     4.0.2       4.0.2
    is_array            standard 4.0.0       4.0.0
    is_bool             standard 4.0.0       4.0.0
    is_float            standard 4.0.0       4.0.0
    is_int              standard 4.0.0       4.0.0
    is_object           standard 4.0.0       4.0.0
    is_resource         standard 4.0.0       4.0.0
    is_string           standard 4.0.0       4.0.0
    key                 standard 4.0.0       4.0.0
    preg_last_error     pcre     5.2.0       5.2.0
 C  preg_last_error_msg user                 7.0.0alpha1
    sprintf             standard 4.0.0       4.0.0
 C  str_contains        standard 8.0.0alpha1 8.0.0alpha1
 C  str_ends_with       standard 8.0.0alpha1 8.0.0alpha1
 C  str_starts_with     standard 8.0.0alpha1 8.0.0alpha1
    strlen              core     4.0.0       4.0.0
    strncmp             core     4.0.0       4.0.0
    strpos              standard 4.0.0       4.0.0
    substr_compare      standard 5.0.0       5.0.0
    Total [27]                               8.0.0alpha1

and

Conditions Analysis

    Condition                            REF      EXT min/Max PHP min/Max
    defined(FILTER_VALIDATE_BOOL)        filter   8.0.0alpha1 8.0.0alpha1
    function_exists(fdiv)                standard 8.0.0alpha1 8.0.0alpha1
    function_exists(get_debug_type)      standard 8.0.0alpha1 8.0.0alpha1
    function_exists(get_resource_id)     standard 8.0.0alpha1 8.0.0alpha1
    function_exists(preg_last_error_msg) standard 8.0.0alpha1 8.0.0alpha1
    function_exists(str_contains)        standard 8.0.0alpha1 8.0.0alpha1
    function_exists(str_ends_with)       standard 8.0.0alpha1 8.0.0alpha1
    function_exists(str_starts_with)     standard 8.0.0alpha1 8.0.0alpha1
    Total [8]                                                 8.0.0alpha1

Actual behaviour

Functions Analysis

    Function            REF      EXT min/Max PHP min/Max
    class_implements    spl      5.1.0       5.1.0
    defined             core     4.0.0       4.0.0
 C  fdiv                standard 8.0.0alpha1 8.0.0alpha1
    function_exists     core     4.0.0       4.0.0
    get_class           core     4.0.0       4.0.0
    get_debug_type      standard 8.0.0alpha1 8.0.0alpha1
    get_parent_class    core     4.0.0       4.0.0
    get_resource_id     core     8.0.0alpha1 8.0.0alpha1
    get_resource_type   core     4.0.2       4.0.2
    is_array            standard 4.0.0       4.0.0
    is_bool             standard 4.0.0       4.0.0
    is_float            standard 4.0.0       4.0.0
    is_int              standard 4.0.0       4.0.0
    is_object           standard 4.0.0       4.0.0
    is_resource         standard 4.0.0       4.0.0
    is_string           standard 4.0.0       4.0.0
    key                 standard 4.0.0       4.0.0
    preg_last_error     pcre     5.2.0       5.2.0
    preg_last_error_msg user                 7.0.0alpha1
    sprintf             standard 4.0.0       4.0.0
    str_contains        standard 8.0.0alpha1 8.0.0alpha1
    str_ends_with       standard 8.0.0alpha1 8.0.0alpha1
    str_starts_with     standard 8.0.0alpha1 8.0.0alpha1
    strlen              core     4.0.0       4.0.0
    strncmp             core     4.0.0       4.0.0
    strpos              standard 4.0.0       4.0.0
    substr_compare      standard 5.0.0       5.0.0
    Total [27]                               8.0.0alpha1

and

Conditions Analysis

    Condition                     REF      EXT min/Max PHP min/Max
    defined(FILTER_VALIDATE_BOOL) filter   8.0.0alpha1 8.0.0alpha1
    function_exists(fdiv)         standard 8.0.0alpha1 8.0.0alpha1
    Total [2]                                          8.0.0alpha1

Other information

llaville commented 3 years ago

Waiting for php-compatinfo-db release 3.5.0, that will include some bugfixes required to solve fully this issue. See https://github.com/llaville/php-compatinfo-db/issues/72