mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Fix to handle wrong pecl versions with hyphen
This commit is contained in:
parent
f4d1db5c23
commit
a274bd910a
@ -59,6 +59,7 @@ describe('Extension tests', () => {
|
|||||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||||
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
||||||
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
|
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
|
||||||
|
${'sqlsrv-1.2.3-beta1'} | ${'7.4'} | ${'add_pecl_extension sqlsrv 1.2.3beta1 extension'}
|
||||||
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
||||||
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
||||||
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
||||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -332,7 +332,9 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
let remove_script = '';
|
let remove_script = '';
|
||||||
await utils.asyncForEach(extensions, async function (extension) {
|
await utils.asyncForEach(extensions, async function (extension) {
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
const [ext_name, ext_version] = extension.split('-');
|
const [ext_name, ext_version] = extension
|
||||||
|
.split(/-(.+)/)
|
||||||
|
.filter(Boolean);
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
@ -1080,7 +1082,7 @@ async function extensionArray(extension_csv) {
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^(:)?(php[-_]|none|zend )/, '$1');
|
.replace(/^(:)?(php[-_]|none|zend )|(-[^-]*)-/, '$1$3');
|
||||||
})
|
})
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,9 @@ export async function addExtensionLinux(
|
|||||||
let remove_script = '';
|
let remove_script = '';
|
||||||
await utils.asyncForEach(extensions, async function (extension: string) {
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension
|
||||||
|
.split(/-(.+)/)
|
||||||
|
.filter(Boolean);
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
@ -235,7 +235,7 @@ add_pecl_extension() {
|
|||||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
fi
|
fi
|
||||||
ext_version=$(php -r "echo phpversion('$extension');")
|
ext_version=$(php -r "echo phpversion('$extension');")
|
||||||
if [ "$ext_version" = "$pecl_version" ]; then
|
if [ "${ext_version/-/}" = "$pecl_version" ]; then
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
disable_extension_helper "$extension" >/dev/null 2>&1
|
disable_extension_helper "$extension" >/dev/null 2>&1
|
||||||
|
@ -292,7 +292,7 @@ export async function extensionArray(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^(:)?(php[-_]|none|zend )/, '$1');
|
.replace(/^(:)?(php[-_]|none|zend )|(-[^-]*)-/, '$1$3');
|
||||||
})
|
})
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user