CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

PHP version detection fix.

Open makss opened this issue 2 years ago • 1 comments

WHY

BEFORE - What was wrong? What was happening before this PR?

Several different versions of PHP can run simultaneously on the server. Now the console command backpack:version shows the default PHP version, but not the actual PHP version being used.

For example:

$ php8.2 artisan backpack:version

### PHP VERSION:
PHP 7.4.33 (cli) (built: Sep  2 2023 08:03:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

### LARAVEL VERSION:
10.25.1.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.1
backpack/crud: 6.2.3
backpack/generators: v4.0.2
backpack/logmanager: v5.0.1
backpack/permissionmanager: 7.0.1
backpack/pro: 2.0.14
backpack/settings: 3.1.0
backpack/theme-coreuiv2: 1.2.1
backpack/theme-coreuiv4: 1.1.1

An error occurs in determining the PHP version. For some reason, a shell command is used that returns the default PHP version. For what? The version can be obtained from PHP itself and this version will be the one on which this code runs.

In this example, the actual PHP version is 8.2.10.

AFTER - What is happening after this PR?

After applying this Pull request (I also added a list of PHP extensions, this can be useful), the result will be like this:

$ php8.2 artisan backpack:version

### PHP VERSION:
8.2.10

### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, intl, exif, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache

### LARAVEL VERSION:
10.25.1.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.1
backpack/crud: 6.2.3
backpack/generators: v4.0.2
backpack/logmanager: v5.0.1
backpack/permissionmanager: 7.0.1
backpack/pro: 2.0.14
backpack/settings: 3.1.0
backpack/theme-coreuiv2: 1.2.1
backpack/theme-coreuiv4: 1.1.1

Is it a breaking change?

No

makss avatar Oct 05 '23 22:10 makss

Hello @makss thanks for PR.

I will ask @pxpm to check it and if it complies with internal reviews, it will be merged.

Cheers.

jcastroa87 avatar Oct 06 '23 12:10 jcastroa87

Thanks @makss 🙏

pxpm avatar Mar 29 '24 10:03 pxpm