array(active support until, security support until) * Source: https://www.php.net/supported-versions.php (release cycle as updated in 2024) */ public static function php_table() { return array( '5.6' => array('2017-01-19', '2018-12-31'), '7.0' => array('2017-12-03', '2019-01-10'), '7.1' => array('2018-12-01', '2019-12-01'), '7.2' => array('2019-11-30', '2020-11-30'), '7.3' => array('2020-12-06', '2021-12-06'), '7.4' => array('2021-11-28', '2022-11-28'), '8.0' => array('2022-11-26', '2023-11-26'), '8.1' => array('2023-11-25', '2025-12-31'), '8.2' => array('2024-12-31', '2026-12-31'), '8.3' => array('2025-12-31', '2027-12-31'), '8.4' => array('2026-12-31', '2028-12-31'), '8.5' => array('2027-12-31', '2029-12-31'), ); } /** * Status of a PHP version: array(status => active|security|eol|unknown, branch, active_until, security_until) */ public static function php($version, $today = null) { $today = $today ? $today : gmdate('Y-m-d'); $branch = implode('.', array_slice(explode('.', $version), 0, 2)); $table = self::php_table(); if (!isset($table[$branch])) { $newest = array_key_last($table); if (version_compare($branch, $newest, '>')) { return array('status' => 'active', 'branch' => $branch, 'active_until' => '', 'security_until' => '', 'newer_than_table' => true); } return array('status' => 'eol', 'branch' => $branch, 'active_until' => '', 'security_until' => ''); } list($active, $security) = $table[$branch]; $status = $today <= $active ? 'active' : ($today <= $security ? 'security' : 'eol'); return array('status' => $status, 'branch' => $branch, 'active_until' => $active, 'security_until' => $security); } /** * Oldest PHP branch that still receives active support (the recommended minimum to move to) */ public static function php_recommended($today = null) { $today = $today ? $today : gmdate('Y-m-d'); foreach (self::php_table() as $branch => $dates) { if ($today <= $dates[0]) { return $branch; } } return array_key_last(self::php_table()); } /** * Database servers: vendor => branch => end of support (null = supported, '?' = not certain) * Sources: https://www.mysql.com/support/eol-notice.html, https://mariadb.org/about/#maintenance-policy */ public static function db_table() { return array( 'mysql' => array( '5.5' => '2018-12-31', '5.6' => '2021-02-28', '5.7' => '2023-10-31', '8.0' => '2026-04-30', '8.4' => '2032-04-30', ), 'mariadb' => array( '10.0' => '2019-03-31', '10.1' => '2020-10-17', '10.2' => '2022-05-23', '10.3' => '2023-05-25', '10.4' => '2024-06-18', '10.5' => '2025-06-24', '10.6' => '2026-07-06', '10.7' => '2023-02-09', '10.8' => '2023-05-20', '10.9' => '2023-08-22', '10.10' => '2023-11-17', '10.11' => '2028-02-16', '11.0' => '2024-06-06', '11.1' => '2024-08-21', '11.2' => '2024-11-21', '11.3' => '2024-05-29', '11.4' => '2029-05-29', ), ); } /** * Parse a server version string, for example "5.5.5-10.11.6-MariaDB-1:10.11.6+maria~ubu2204" * or "8.0.36". Returns array(vendor, version, branch). */ public static function parse_db_version($server_info, $comment = '') { $vendor = 'mysql'; if (stripos($server_info, 'mariadb') !== false || stripos($comment, 'mariadb') !== false) { $vendor = 'mariadb'; } elseif (stripos($comment, 'percona') !== false) { $vendor = 'percona'; } $info = preg_replace('/^5\.5\.5-/', '', $server_info); $version = preg_match('/^(\d+\.\d+(?:\.\d+)?)/', $info, $m) ? $m[1] : ''; $branch = $version !== '' ? implode('.', array_slice(explode('.', $version), 0, 2)) : ''; return array('vendor' => $vendor, 'version' => $version, 'branch' => $branch); } /** * Support status: array(status => supported|eol|unknown|innovation, until) */ public static function db($vendor, $branch, $today = null) { $today = $today ? $today : gmdate('Y-m-d'); $table_vendor = $vendor === 'percona' ? 'mysql' : $vendor; $table = self::db_table(); if ($branch === '' || !isset($table[$table_vendor])) { return array('status' => 'unknown', 'until' => ''); } if (isset($table[$table_vendor][$branch])) { $until = $table[$table_vendor][$branch]; return array('status' => $today <= $until ? 'supported' : 'eol', 'until' => $until); } if ($table_vendor === 'mysql') { if (version_compare($branch, '5.5', '<')) { return array('status' => 'eol', 'until' => ''); } // 8.1–8.3 and 9.x are "innovation" releases, each supported only until the next one if (version_compare($branch, '8.0', '>') && $branch !== '8.4') { return array('status' => 'innovation', 'until' => ''); } } if ($table_vendor === 'mariadb' && version_compare($branch, '10.0', '<')) { return array('status' => 'eol', 'until' => ''); } return array('status' => 'unknown', 'until' => ''); } }