@@ -278,11 +278,12 @@ function get_distname() {
278278
279279 //** RHEL (including compatible clones) & Fedora
280280 elseif (file_exists ('/etc/redhat-release ' ) && file_exists ('/etc/os-release ' )) {
281+
281282 $ content = file_get_contents ('/etc/os-release ' );
282283
283284 preg_match ('/(?<=PRETTY_NAME=\").+?(?=\")/ ' , $ content , $ prettyname );
284285 preg_match ('/(?<=NAME=\").+?(?=\")/ ' , $ content , $ name );
285- preg_match ('/(?<=VERSION=\").+?(?=\")/ ' , $ content , $ version );
286+ preg_match ('/(?<=VERSION=\").+?(?=\")/ ' , $ content , $ version );
286287 preg_match ('/(?<=VERSION_ID=\").+?(?=\")/ ' , $ content , $ versionid );
287288
288289 if (stristr ($ prettyname [0 ], 'Fedora 32 (Thirty Two) ' )) {
@@ -298,15 +299,15 @@ function get_distname() {
298299 //** RHEL 7 and compatible clones
299300 } elseif (preg_match ('/^(?:7|7\.[0-9]{1,2})$/ ' , $ versionid [0 ])) {
300301 preg_match_all ('/([0-9]{1,2})\.?([0-9]{0,2})\.?([0-9]*)/ ' , file_get_contents ('/etc/redhat-release ' ), $ centos7_version );
301- $ distname = $ name [0 ];
302- $ distver = is_array ($ centos7_version )? implode ('. ' , array_filter (array ($ centos7_version [1 ][0 ],$ centos7_version [2 ][0 ],$ centos7_version [3 ][0 ]),'strlen ' )) : $ version [0 ];
303- $ distid = 'centos72 ' ;
304- $ distbaseid = 'fedora ' ;
302+ $ distname = $ name [0 ];
303+ $ distver = is_array ($ centos7_version )? implode ('. ' , array_filter (array ($ centos7_version [1 ][0 ],$ centos7_version [2 ][0 ],$ centos7_version [3 ][0 ]),'strlen ' )) : $ version [0 ];
304+ $ distid = 'centos72 ' ;
305+ $ distbaseid = 'fedora ' ;
305306 //** RHEL 8 and compatible clones
306307 } elseif (preg_match ('/^(?:8|8\.[0-9]{1,2})$/ ' , $ versionid [0 ])) {
307- $ distname = $ name [0 ];
308- $ distver = $ version [0 ];
309- $ distid = 'centos80 ' ;
308+ $ distname = $ name [0 ];
309+ $ distver = $ version [0 ];
310+ $ distid = 'centos80 ' ;
310311 $ distbaseid = 'fedora ' ;
311312 } else {
312313 $ distname = 'Redhat ' ;
@@ -322,7 +323,7 @@ function get_distname() {
322323 if (stristr ($ content , 'CentOS Linux release 6 ' ) || stristr ($ content , 'CentOS release 6 ' )) {
323324 preg_match_all ('/(6\.?([0-9]{0,2})\.?(\s)?([a-zA-Z()]+))$/ ' , $ content , $ centos6_version );
324325 $ distname = 'CentOS Linux ' ;
325- $ distver = is_array ( $ centos6_version)? implode ( ' . ' , array_filter ( array ( $ centos6_version [0 ][0 ]), ' strlen ' )) : '6 ' ;
326+ $ distver = $ centos6_version[ 0 ][ 0 ] ? $ centos6_version [0 ][0 ] : '6 ' ;
326327 $ distid = 'centos53 ' ;
327328 $ distbaseid = 'fedora ' ;
328329 } else {
@@ -339,7 +340,7 @@ function get_distname() {
339340 if (stristr ($ content , 'CentOS Linux release 6 ' ) || stristr ($ content , 'CentOS release 6 ' )) {
340341 preg_match_all ('/(6)\.?([0-9]{0,2})?\.?\s([a-zA-Z(), ]+)?$/ ' , $ content , $ centos6_version );
341342 $ distname = 'CentOS Linux ' ;
342- $ distver = $ centos6_version [0 ][0 ];
343+ $ distver = $ centos6_version [0 ][0 ] ? $ centos6_version [ 0 ][ 0 ] : ' 6 ' ;
343344 $ distid = 'centos53 ' ;
344345 $ distbaseid = 'fedora ' ;
345346 } else {
@@ -351,8 +352,6 @@ function get_distname() {
351352 }
352353
353354
354-
355-
356355 //** Gentoo
357356 elseif (file_exists ('/etc/gentoo-release ' )) {
358357
0 commit comments