From 8e80635955da43631a71bfeddcda8fb93a21c9f0 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 25 Aug 2021 20:09:50 +0530 Subject: [PATCH] Fix parsing extensions input if `Zend OPcache` is specified instead of `opcache` --- __tests__/utils.test.ts | 9 +++------ dist/index.js | 2 +- src/utils.ts | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 47374be0..21178c9d 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -126,12 +126,9 @@ describe('Utils tests', () => { }); it('checking extensionArray', async () => { - expect(await utils.extensionArray('a, b, php_c, php-d')).toEqual([ - 'a', - 'b', - 'c', - 'd' - ]); + expect( + await utils.extensionArray('a, :b, php_c, php-d, Zend e, :Zend f') + ).toEqual(['a', ':b', 'c', 'd', 'e', ':f']); expect(await utils.extensionArray('')).toEqual([]); expect(await utils.extensionArray(' ')).toEqual([]); diff --git a/dist/index.js b/dist/index.js index 777c92f3..ee3457b1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1050,7 +1050,7 @@ async function extensionArray(extension_csv) { return extension .trim() .toLowerCase() - .replace(/^php[-_]/, ''); + .replace(/^(:)?(php[-_]|zend )/, '$1'); }) .filter(Boolean); } diff --git a/src/utils.ts b/src/utils.ts index 2f47cb81..9ca471a5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -289,7 +289,7 @@ export async function extensionArray( return extension .trim() .toLowerCase() - .replace(/^php[-_]/, ''); + .replace(/^(:)?(php[-_]|zend )/, '$1'); }) .filter(Boolean); }