Drop PHP 5.3 support

This commit is contained in:
Alexander A. Klimov 2017-12-15 11:17:07 +01:00 committed by Eric Lippmann
parent 4b7dc0c350
commit fc1f6e13ab
13 changed files with 63 additions and 127 deletions

View File

@ -9,16 +9,6 @@ php:
- '7.0'
- '7.1'
matrix:
include:
- php: '5.3'
dist: precise
sudo: required
env:
- PHPCS_VERSION=2.9.1
- LOCALE_GEN=1
- ENABLE_LDAP=1
services:
- mysql
- postgresql

View File

@ -30,15 +30,6 @@ class WebCommand extends Command
*/
public function serveAction()
{
$minVersion = '5.4.0';
if (version_compare(PHP_VERSION, $minVersion) < 0) {
throw new IcingaException(
'You are running PHP %s, internal webserver requires %s.',
PHP_VERSION,
$minVersion
);
}
$fork = $this->params->get('daemonize');
$listen = $this->params->get('listen');
$port = $this->params->get('port');

View File

@ -46,7 +46,6 @@ class DbResourceForm extends Form
$dbChoices['oci'] = 'Oracle (OCI8)';
}
$offerSsl = false;
$offerPostgres = false;
$offerIbm = false;
$offerMysql = false;
@ -55,9 +54,6 @@ class DbResourceForm extends Form
$offerPostgres = true;
} elseif ($dbChoice === 'mysql') {
$offerMysql = true;
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
$offerSsl = true;
}
} elseif ($dbChoice === 'ibm') {
$offerIbm = true;
}
@ -161,62 +157,60 @@ class DbResourceForm extends Form
'label' => $this->translate('Persistent')
)
);
if ($offerSsl) {
$this->addElement(
'checkbox',
'use_ssl',
array(
'autosubmit' => true,
'label' => $this->translate('Use SSL'),
'description' => $this->translate(
'Whether to encrypt the connection or to authenticate using certificates'
)
)
);
if (isset($formData['use_ssl']) && $formData['use_ssl']) {
$this->addElement(
'checkbox',
'use_ssl',
'text',
'ssl_key',
array(
'autosubmit' => true,
'label' => $this->translate('Use SSL'),
'description' => $this->translate(
'Whether to encrypt the connection or to authenticate using certificates'
'label' => $this->translate('SSL Key'),
'description' => $this->translate('The client key file path')
)
);
$this->addElement(
'text',
'ssl_cert',
array(
'label' => $this->translate('SSL Certificate'),
'description' => $this->translate('The certificate file path')
)
);
$this->addElement(
'text',
'ssl_ca',
array(
'label' => $this->translate('SSL CA'),
'description' => $this->translate('The CA certificate file path')
)
);
$this->addElement(
'text',
'ssl_capath',
array(
'label' => $this->translate('SSL CA Path'),
'description' => $this->translate(
'The trusted CA certificates in PEM format directory path'
)
)
);
if (isset($formData['use_ssl']) && $formData['use_ssl']) {
$this->addElement(
'text',
'ssl_key',
array(
'label' => $this->translate('SSL Key'),
'description' => $this->translate('The client key file path')
)
);
$this->addElement(
'text',
'ssl_cert',
array(
'label' => $this->translate('SSL Certificate'),
'description' => $this->translate('The certificate file path')
)
);
$this->addElement(
'text',
'ssl_ca',
array(
'label' => $this->translate('SSL CA'),
'description' => $this->translate('The CA certificate file path')
)
);
$this->addElement(
'text',
'ssl_capath',
array(
'label' => $this->translate('SSL CA Path'),
'description' => $this->translate(
'The trusted CA certificates in PEM format directory path'
)
)
);
$this->addElement(
'text',
'ssl_cipher',
array(
'label' => $this->translate('SSL Cipher'),
'description' => $this->translate('The list of permissible ciphers')
)
);
}
$this->addElement(
'text',
'ssl_cipher',
array(
'label' => $this->translate('SSL Cipher'),
'description' => $this->translate('The list of permissible ciphers')
)
);
}
return $this;

View File

@ -374,13 +374,7 @@ class Donut
protected function encode($content)
{
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
$replaceFlags = ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5;
} else {
$replaceFlags = ENT_COMPAT | ENT_IGNORE;
}
return htmlspecialchars($content, $replaceFlags, 'UTF-8', true);
return htmlspecialchars($content, ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8', true);
}
protected function renderAttributes(array $attributes)

View File

@ -98,7 +98,7 @@ abstract class Filter
}
}
krsort($operators, version_compare(PHP_VERSION, '5.4.0') >= 0 ? SORT_NATURAL : SORT_REGULAR);
krsort($operators, SORT_NATURAL);
foreach ($operators as $id => $operator) {
$f = $filter->getById($id);
if ($f->getOperatorName() !== $operator) {

View File

@ -427,10 +427,7 @@ class LdapConnection implements Selectable, Inspectable
{
$this->bind();
if ($query->getUsePagedResults()
&& version_compare(PHP_VERSION, '5.4.0') >= 0
&& $this->getCapabilities()->hasPagedResult()
) {
if ($query->getUsePagedResults() && $this->getCapabilities()->hasPagedResult()) {
return $this->runPagedQuery($query, $fields);
} else {
return $this->runQuery($query, $fields);
@ -1156,11 +1153,7 @@ class LdapConnection implements Selectable, Inspectable
$sequenceOf = '30' . str_pad(dechex($sequenceOfOctets), 2, '0', STR_PAD_LEFT) . $sequenceOf;
}
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
return hex2bin($sequenceOf);
} else {
return pack('H*', $sequenceOf);
}
return hex2bin($sequenceOf);
}
/**

View File

@ -23,9 +23,7 @@ class Json
*/
public static function encode($value, $options = 0, $depth = 512)
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$encoded = json_encode($value);
} elseif (version_compare(phpversion(), '5.5.0', '<')) {
if (version_compare(phpversion(), '5.5.0', '<')) {
$encoded = json_encode($value, $options);
} else {
$encoded = json_encode($value, $options, $depth);
@ -49,11 +47,7 @@ class Json
*/
public static function decode($json, $assoc = false, $depth = 512, $options = 0)
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$decoded = json_decode($json, $assoc, $depth);
} else {
$decoded = json_decode($json, $assoc, $depth, $options);
}
$decoded = json_decode($json, $assoc, $depth, $options);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new JsonDecodeException('%s: %s', static::lastErrorMsg(), var_export($json, true));

View File

@ -80,10 +80,6 @@ class StyleSheet
*/
public function __construct()
{
// PHP had a rather conservative PCRE backtrack limit unless 5.3.7
if (version_compare(PHP_VERSION, '5.3.7') <= 0) {
ini_set('pcre.backtrack_limit', 1000000);
}
$app = Icinga::app();
$this->app = $app;
$this->lessCompiler = new LessCompiler();

View File

@ -58,11 +58,6 @@ class View extends Zend_View_Abstract
*/
const CHARSET = 'UTF-8';
/**
* The flags we use for htmlspecialchars depend on our PHP version
*/
private $replaceFlags;
/**
* Flag to register stream wrapper
*
@ -97,12 +92,6 @@ class View extends Zend_View_Abstract
}
}
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
$this->replaceFlags = ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5;
} else {
$this->replaceFlags = ENT_COMPAT | ENT_IGNORE;
}
parent::__construct($config);
}
@ -124,7 +113,7 @@ class View extends Zend_View_Abstract
*/
public function escape($value)
{
return htmlspecialchars($value, $this->replaceFlags, self::CHARSET, true);
return htmlspecialchars($value, ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5, self::CHARSET, true);
}
/**

View File

@ -668,7 +668,7 @@ class FilterEditor extends AbstractWidget
}
}
krsort($operators, version_compare(PHP_VERSION, '5.4.0') >= 0 ? SORT_NATURAL : SORT_REGULAR);
krsort($operators, SORT_NATURAL);
foreach ($operators as $id => $operator) {
$f = $filter->getById($id);
if ($f->getOperatorName() !== $operator) {

View File

@ -884,11 +884,9 @@ msgstr "Root DN"
#: ../../../../modules/setup/library/Setup/WebWizard.php:556
msgid ""
"Running Icinga Web 2 requires PHP version 5.3.2. Advanced features like the "
"built-in web server require PHP version 5.4."
"Running Icinga Web 2 requires PHP version 5.4."
msgstr ""
"Der Betrieb von Icinga Web 2 erfordert die PHP-Version 5.3.2. Anspruchsvolle "
"Funktionalitäten wie der eingebaute Webserver erfordern die PHP-Version 5.4."
"Der Betrieb von Icinga Web 2 erfordert die PHP-Version 5.4."
#: ../../../../modules/setup/library/Setup/Steps/ResourceStep.php:104
msgid "SSL Cert"

View File

@ -862,11 +862,9 @@ msgstr "Root DN"
#: /usr/share/icingaweb2/modules/setup/library/Setup/WebWizard.php:552
msgid ""
"Running Icinga Web 2 requires PHP version 5.3.2. Advanced features like the "
"built-in web server require PHP version 5.4."
"Running Icinga Web 2 requires PHP version 5.4."
msgstr ""
"Icinga Web 2 richiede PHP 5.3.2. Funzionalità avanzate come il web server "
"integrato richiedono PHP 5.4."
"Icinga Web 2 richiede PHP 5.4."
#: /usr/share/icingaweb2/modules/setup/library/Setup/WebWizard.php:356
msgid "Setup Icinga Web 2"

View File

@ -568,11 +568,10 @@ class WebWizard extends Wizard implements SetupWizard
$set = new RequirementSet();
$set->add(new PhpVersionRequirement(array(
'condition' => array('>=', '5.3.2'),
'condition' => array('>=', '5.4'),
'description' => mt(
'setup',
'Running Icinga Web 2 requires PHP version 5.3.2. Advanced features'
. ' like the built-in web server require PHP version 5.4.'
'Running Icinga Web 2 requires PHP version 5.4.'
)
)));