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
373 stars 20 forks source link

OCI does not show up in extensions #263

Closed LeoShivas closed 4 years ago

LeoShivas commented 4 years ago

I have an application which uses OCI functions as oci_connect, oci_fetcharray, oci*** etc ... Theses functions are enabled by the oci8 PHP extension.

Why, when I launch the phpcompatinfo analyser, this PHP extension doesn't show up ?

Data Source Analysed

Directories                                       1063
Files                                             6923
Errors                                               0

Extensions Analysis

    Extension       Matches REF          EXT min/Max     PHP min/Max           PHP all
    Core                    Core         7.2.0           7.0.2
    PDO                     PDO          5.1.0           5.1.0
    Reflection              Reflection   7.0.0alpha1     7.0.0alpha1
    SimpleXML               SimpleXML    5.0.1           5.0.1
    XCache                  XCache       1.0             4.3.0
 C  Zend OPcache            Zend OPcache                 5.2.0
 C  Zend Optimizer+         user                         4.0.0
    amqp                    amqp         1.0.0           5.2.0
    apc                     apc          3.1.4           5.1.0
 C  apcu                    apcu         4.0.0           7.0.0
    bcmath                  bcmath       4.0.0           4.0.0
    ctype                   ctype        4.0.4           4.0.4
 C  curl                    curl         5.5.0           5.5.24RC1
    date                    date         5.5.0           5.5.0
 C  dom                     user         5.0.0           5.0.0
 C  exif                    user         4.3.0           4.3.0
 C  fileinfo                fileinfo     1.0.5-dev       5.3.0
    filter                  filter       0.11.0          5.0.0
    ftp                     ftp          5.0.0           5.0.0
 C  gd                      gd           4.3.2           7.2.0alpha1
 C  gmagick                 user                         4.0.0
    gmp                     gmp          4.0.4           4.0.4
    hash                    hash         5.6.0beta1      5.6.0beta1
 C  iconv                   iconv        5.0.0           5.0.0
 C  igbinary                user         1.1.1           5.2.0
 C  imagick                 user         3.4.0           5.4.0
 C  intl                    intl         2.0.0b1         5.4.0RC3
    json                    json         5.6.6RC1        5.6.6RC1
    ldap                    ldap         4.0.4           4.0.4
    libevent                libevent     0.0.2           5.3.0
 C  libsodium               user                         4.0.0
    libxml                  libxml       5.4.0           5.4.0
 C  mbstring                mbstring     7.2.0alpha1     7.2.0alpha1
    mcrypt                  mcrypt       4.0.2 => 7.1.30 4.0.2 => 7.1.30
 C  memcached               user         0.1.0           5.2.0
    mhash                   mhash        4.0.0           4.0.0
    mongo                   mongo        1.3.0RC3        5.2.6
    mysql                   mysql        4.0.5           4.0.5
    mysqli                  mysqli       5.5.0           5.5.0
 C  newrelic                user                         4.0.0
 C  opendkim                user                         4.0.0
 C  openssl                 openssl      5.6.0alpha1     5.6.0alpha1
 C  pcntl                   pcntl        7.1.0           7.1.0beta1
 C  pcre                    pcre         5.2.9           5.2.9
    pdflib                  pdflib       3.0.1           5.2.0
 C  pdo_sqlite              user                         4.0.0
    pgsql                   pgsql        5.2.0           5.2.0
 C  phar                    user         1.0.0           5.2.0
 C  posix                   posix        4.0.0           4.0.0
 C  redis                   user         2.2.3           5.2.0
 C  session                 session      7.0.0           7.0.0alpha1
 C  sockets                 sockets      4.1.0           4.1.0
 C  sodium                  user                         4.0.0
    spl                     spl          7.2.0           7.2.0beta3
    sqlite3                 sqlite3      5.3.0           5.3.0
    standard                standard     7.3.0           7.3.0alpha4
    tokenizer               tokenizer    7.0.0RC1        7.0.0 => 5.6.40
 C  uri_template            user                         4.0.0
 C  xdebug                  user                         4.3.0
 C  xml                     user         4.0.0 => 7.1.25 4.0.0
    xmlreader               xmlreader    5.0.0           5.0.0
 C  xmlwriter               user         5.1.2           5.1.2
 C  zip                     zip          1.6.0           5.2.0
 C  zlib                    zlib         7.0.0alpha1     7.0.0alpha1
    Total [64]                                           7.3.0alpha4 => 7.1.30

Also, why, when I launch the phpcompatinfo reference:list command, this PHP extension doesn't show up ?

Reference Database Version => 2.x-dev@effa54c

 Reference      Version    State  Release Date Loaded
 amqp           1.9.4      stable 2019-01-02
 apc            3.1.13     beta   2012-09-03
 apcu           5.1.16     stable 2018-12-16   5.1.17
 ast            1.0.0      stable 2018-10-21
 bcmath         7.1.30     stable 2019-05-30   7.3.4
 bz2            7.1.30     stable 2019-05-30   7.3.4
 calendar       7.1.30     stable 2019-05-30   7.3.4
 Core           7.2.19     stable 2019-05-30   7.3.4
 ctype          7.1.30     stable 2019-05-30   7.3.4
 curl           7.1.30     stable 2019-05-30   7.3.4
 date           7.1.30     stable 2019-05-30   7.3.4
 dom            5.1.0      stable 2004-07-13   7.3.5
 enchant        1.1.0      stable 2009-10-08
 ereg           4.0.1      stable 2000-06-28
 exif           4.3.0      stable 2002-12-27
 fileinfo       1.0.5-dev  stable 2009-06-30   7.3.4
 filter         7.1.30     stable 2019-05-30   7.3.4
 ftp            7.1.30     stable 2019-05-30
 gd             7.1.30     stable 2019-05-30   7.3.4
 gender         1.1.0      stable 2015-02-03
 geoip          1.1.1      beta   2016-08-19
 gettext        4.2.0      stable 2002-04-22   7.3.4
 gmp            7.1.30     stable 2019-05-30
 haru           1.0.4      stable 2012-12-23
 hash           5.6.0beta1 beta   2014-04-11   7.3.4
 htscanner      1.0.1      stable 2012-03-01
 http           3.2.0      stable 2018-07-19
 iconv          5.0.0      stable 2004-07-13   7.3.4
 igbinary       3.0.1      stable 2019-03-21
 imagick        3.4.4      stable 2019-05-02
 imap           5.3.6      stable 2011-03-17
 inclued        0.1.3      beta   2012-06-12
 intl           5.5.1      stable 2013-07-18   7.3.4
 jsmin          2.0.1      stable 2015-11-13
 json           5.6.6RC1   beta   2015-02-05   1.7.0
 ldap           7.1.30     stable 2019-05-30   7.3.4
 libevent       0.1.0      beta   2013-05-22
 libxml         5.5.2      stable 2013-08-15   7.3.4
 lzf            1.6.7      stable 2018-12-20
 mailparse      3.0.3      stable 2019-03-20
 mbstring       7.3.6      stable 2019-05-30   7.3.4
 mcrypt         4.0.2      stable 2000-08-29
 memcache       3.0.8      beta   2013-04-10
 memcached      3.1.3      stable 2018-12-24
 mhash          4.0.4      stable 2000-12-19
 mongo          1.6.16     stable 2017-09-05
 msgpack        2.0.3      stable 2018-12-20
 mssql          5.5.2      stable 2013-08-13
 mysql          5.2.3      stable 2007-05-31
 mysqli         7.1.30     stable 2019-05-30   7.3.4
 OAuth          2.0.2      stable 2016-06-18
 odbc           5.4.32RC1  beta   2014-08-07   7.3.4
 openssl        7.1.30     stable 2019-05-30   7.3.4
 pcntl          5.3.4      stable 2010-12-09
 pcre           5.3.0      stable 2009-06-30   7.3.4
 pdflib         3.0.4      stable 2014-01-15
 PDO            5.1.0      stable 2004-07-13   7.3.4
 pgsql          7.1.30     stable 2019-05-30
 phar           2.0.0a1    alpha  2008-03-26   7.3.4
 posix          5.2.0      stable 2006-11-02   7.3.4
 pthreads       3.1.6      stable 2016-02-13
 raphf          2.0.0      stable 2016-01-19
 rar            4.0.0      stable 2017-07-22
 readline       5.4.0      stable 2012-03-01
 recode         4.0.0      stable 2000-05-22
 redis          4.3.0      stable 2019-03-13
 Reflection     5.4.0      stable 2012-03-01   7.3.4
 riak           1.2.0      stable 2014-05-15
 session        7.1.30     stable 2019-05-30   7.3.4
 shmop          7.1.30     stable 2019-05-30
 SimpleXML      5.0.1      stable 2004-08-12   7.3.4
 snmp           5.4.0      stable 2012-03-01
 soap           7.1.30     stable 2019-05-30   7.3.4
 sockets        7.1.30     stable 2019-05-30   7.3.4
 solr           2.3.0      stable 2015-12-01
 sphinx         1.3.3      stable 2015-05-21
 spl            7.1.30     stable 2019-05-30   7.3.4
 sqlite         2.0-dev    stable 2004-07-13
 sqlite3        7.1.30     stable 2019-05-30   7.3.4
 ssh2           1.1.2      alpha  2017-07-23   1.2
 standard       7.2.19     stable 2019-05-30   7.3.4
 stomp          2.0.2      stable 2018-06-29
 svn            1.0.2      stable 2012-07-23
 sync           1.1.1      stable 2017-02-20
 sysvmsg        5.3.0      stable 2009-06-30
 sysvsem        4.1.0      stable 2001-12-10
 sysvshm        5.3.0      stable 2009-06-30
 tidy           7.1.30     stable 2019-05-30
 tokenizer      5.6.0RC1   beta   2014-06-19   7.3.4
 uopz           6.0.1      stable 2019-02-06
 uploadprogress 1.0.3.1    stable 2011-08-15
 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         2.7.2      stable 2019-05-06
 xhprof         0.9.0      beta   2009-03-18
 xml            4.0.5      stable 2001-04-30   7.3.4
 xmldiff        1.1.2      stable 2015-02-03
 xmlreader      5.0.0      stable 2004-07-13   7.3.4
 xmlrpc         7.1.30     stable 2019-05-30
 xmlwriter      5.2.0      stable 2006-11-02   7.3.4
 xsl            7.1.30     stable 2019-05-30
 yac            0.9.0      beta   2014-07-23
 yaml           1.3.2      stable 2018-11-24
 Zend OPcache   7.1.30     stable 2019-05-30   7.3.4
 zip            1.15.4     stable 2018-10-03   1.15.4
 zlib           5.4.0      stable 2012-03-01   7.3.4
 Total          [107]                          [43]

Another strange point, the oci_* PHP functions are tagged "user" in the REF colunm :

....
    oci_bind_by_name                                                          1       user                         4.0.0
    oci_cancel                                                                1       user                         4.0.0
    oci_commit                                                                1       user                         4.0.0
    oci_connect                                                               1       user                         4.0.0
    oci_error                                                                 6       user                         4.0.0
    oci_execute                                                               1       user                         4.0.0
    oci_fetch_all                                                             1       user                         4.0.0
    oci_fetch_array                                                           2       user                         4.0.0
    oci_fetch_object                                                          1       user                         4.0.0
    oci_new_descriptor                                                        1       user                         4.0.0
    oci_num_fields                                                            1       user                         4.0.0
    oci_num_rows                                                              1       user                         4.0.0
    oci_parse                                                                 1       user                         4.0.0
    oci_pconnect                                                              1       user                         4.0.0
    oci_rollback                                                              1       user                         4.0.0
    oci_server_version                                                        1       user                         4.0.0
....

I think this behaviour is due to the fact that PhpCompatInfo does not have oci8-like REF.

My PhpCompatInfo version : phpCompatInfo version 5.2.1 DB version 2.x-dev@effa54c built Jun 26 2019 17:35:50 CEST

My PHP version :

Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.4, Copyright (c) 1999-2018, by Zend Technologies

My PHP extensions :

[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
fileinfo
filter
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
oci8
odbc
openssl
pcre
PDO
pdo_mysql
PDO_OCI
PDO_ODBC
pdo_sqlite
pdo_sqlsrv
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
sqlsrv
ssh2
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
llaville commented 4 years ago

Thanks for your full report (I appreciate a lot). As I've limited internet connection for a week, I'll check it in 7 days.

llaville commented 4 years ago

@LeoShivas You're right : oci8 extension is not yet supported by bartlett/php-compatinfo-db project. I'll add it and publish soon a new version that will also support PHP 7.3.19 and PHP 7.4.7

llaville commented 4 years ago

@LeoShivas Oci8 support has just been added to bartlett/php-compatinfo-db.

Please test it and report any issue you may find before upcoming next release 2.15 (planned in next days). Thanks !

llaville commented 4 years ago

Without reply, I'll release the new version 2.15 of compatinfo-db in 2 days (July 1st).

LeoShivas commented 4 years ago

Without reply, I'll release the new version 2.15 of compatinfo-db in 2 days (July 1st).

@llaville , I'm very glad that you had commited, but I don't master well how I can try your commit. How can I do ? With Composer ? How ?

I tried this :

mkdir phpcompatinfo_test
cd phpcompatinfo_test
composer clear-cache
composer require bartlett/php-compatinfo-db:2.x-dev#a47f461332624ee9222132de42c98d9b55d70ae4 bartlett/php-compatinfo:5.2.x-dev#018b5d9035f207748854a7149ddc69dd988d60ed
./vendor/bartlett/php-compatinfo/bin/phpcompatinfo analyser:run ../myPhpApp > ../tmp3.txt

The oci_* functions are stil recognized as 'user' function :

    oci_bind_by_name                                                          1       user                         4.0.0                             
    oci_cancel                                                                1       user                         4.0.0                             
    oci_commit                                                                1       user                         4.0.0                             
    oci_connect                                                               1       user                         4.0.0                             
    oci_error                                                                 6       user                         4.0.0                             
    oci_execute                                                               1       user                         4.0.0                             
    oci_fetch_all                                                             1       user                         4.0.0                             
    oci_fetch_array                                                           2       user                         4.0.0                             
    oci_fetch_object                                                          1       user                         4.0.0                             
    oci_new_descriptor                                                        1       user                         4.0.0                             
    oci_num_fields                                                            1       user                         4.0.0                             
    oci_num_rows                                                              1       user                         4.0.0                             
    oci_parse                                                                 1       user                         4.0.0                             
    oci_pconnect                                                              1       user                         4.0.0                             
    oci_rollback                                                              1       user      

I think that I certainly misunderstodd how to use your last commit...

llaville commented 4 years ago
  1. First install a fresh copy of php-compatinfo
mkdir phpcompatinfo_test
cd phpcompatinfo_test
composer require bartlett/php-compatinfo
  1. edit your composer.json file and add the constaint as follow
{
    "require": {
        "bartlett/php-compatinfo": "^5.2",
        "bartlett/php-compatinfo-db": "2.x-dev"
    }
}
  1. update your dependencies with composer update

you should have something like

Package operations: 0 installs, 1 update, 0 removals
  - Removing bartlett/php-compatinfo-db (2.14.0)
  - Installing bartlett/php-compatinfo-db (2.x-dev 1f1ee22): Cloning 1f1ee223ba from cache
  1. refresh your DB version that is not yet commited in the compatinfo-db repository, by running following command:
    vendor/bartlett/php-compatinfo-db/bin/compatinfo-db bartlett:db:init

And verify that you have the latest version built / installed with command :

vendor/bin/phpcompatinfo --version

you should have something like that with current timestamp

phpCompatInfo version 5.2.3 DB version 2.x-dev@1f1ee22 built Jun 30 2020 xx:xx:xx UTC
LeoShivas commented 4 years ago

@llaville good work !

This is the compatinfo-db bartlett:db:init step I missed.

I confirm you code works like a charm :

....
 C  newrelic                user                         4.0.0                        
    oci8                    oci8         1.4.0           4.3.9                        
 C  opendkim                user                         4.0.0                        
....

And the oci_* functions :

....
    oci_bind_by_name                                                          1       oci8         1.1             4.3.0                             
    oci_cancel                                                                1       oci8         1.1             4.3.0                             
    oci_commit                                                                1       oci8         1.1             4.3.0                             
    oci_connect                                                               1       oci8         1.1             4.3.0                             
    oci_error                                                                 6       oci8         1.1             4.3.0                             
    oci_execute                                                               1       oci8         1.1             4.3.0                             
    oci_fetch_all                                                             1       oci8         1.1             4.3.0                             
    oci_fetch_array                                                           2       oci8         1.1             4.3.0                             
    oci_fetch_object                                                          1       oci8         1.1             4.3.0                             
    oci_new_descriptor                                                        1       oci8         1.1             4.3.0                             
    oci_num_fields                                                            1       oci8         1.1             4.3.0                             
    oci_num_rows                                                              1       oci8         1.1             4.3.0                             
    oci_parse                                                                 1       oci8         1.1             4.3.0                             
    oci_pconnect                                                              1       oci8         1.1             4.3.0                             
    oci_rollback                                                              1       oci8         1.1             4.3.0                             
    oci_server_version                                                        1       oci8         1.0             4.3.0                             
....

Thank you very much !

llaville commented 4 years ago

@LeoShivas Thanks for feedback. Official CompatInfo-DB 2.15.0 has just been released !