Skip to content

Commit 9220d19

Browse files
author
Till Brehm
committed
Merge branch '6419-isset' into 'develop'
PHP 8 strict fixes, #6419 Closes #6419 See merge request ispconfig/ispconfig3!1670
2 parents 483cf6f + 697ce3b commit 9220d19

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

server/lib/classes/letsencrypt.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ public function get_website_certificate_paths($data) {
304304
'domain' => $domain,
305305
'key' => $ssl_dir.'/'.$domain.'-le.key',
306306
'key2' => $ssl_dir.'/'.$domain.'-le.key.org',
307+
'csr' => '', # Not used for LE.
307308
'crt' => $ssl_dir.'/'.$domain.'-le.crt',
308309
'bundle' => $ssl_dir.'/'.$domain.'-le.bundle'
309310
);

server/plugins-available/apache2_plugin.inc.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ function ssl($event_name, $data) {
266266
// load the server configuration options
267267
$app->uses('getconf');
268268
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
269-
if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
269+
if (isset($web_config['CA_path']) && $web_config['CA_path'] !='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
270270
$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf', LOGLEVEL_ERROR);
271271

272272
//* Only vhosts can have a ssl cert
@@ -1169,7 +1169,7 @@ function update($event_name, $data) {
11691169
if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
11701170

11711171
//* add open_basedir restriction to custom php.ini content, required for suphp only
1172-
if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
1172+
if(isset($data['new']['custom_php_ini']) && !stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
11731173
$data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n";
11741174
}
11751175

@@ -1194,7 +1194,7 @@ function update($event_name, $data) {
11941194
//* Create custom php.ini
11951195
# Because of custom default PHP directives from snippet
11961196
# php.ini custom values order os: 1. general settings 2. Directive Snippets settings 3. custom php.ini settings defined in domain settings
1197-
if(trim($data['new']['custom_php_ini']) != '' || $data['new']['directive_snippets_id'] > "0") {
1197+
if((isset($data['new']['custom_php_ini']) && trim($data['new']['custom_php_ini']) != '') || $data['new']['directive_snippets_id'] > "0") {
11981198
$has_custom_php_ini = true;
11991199
$custom_sendmail_path = false;
12001200
if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir);
@@ -1400,14 +1400,12 @@ function update($event_name, $data) {
14001400

14011401
$server_alias = array();
14021402

1403-
// get autoalias
1404-
$auto_alias = $web_config['website_autoalias'];
1405-
if($auto_alias != '') {
1403+
if(isset($web_config['website_autoalias']) && $web_config['website_autoalias'] != '') {
14061404
// get the client username
14071405
$client = $app->db->queryOneRecord("SELECT `username` FROM `client` WHERE `client_id` = ?", $client_id);
14081406
$aa_search = array('[client_id]', '[website_id]', '[client_username]', '[website_domain]');
14091407
$aa_replace = array($client_id, $data['new']['domain_id'], $client['username'], $data['new']['domain']);
1410-
$auto_alias = str_replace($aa_search, $aa_replace, $auto_alias);
1408+
$auto_alias = str_replace($aa_search, $aa_replace, $web_config['website_autoalias']);
14111409
unset($client);
14121410
unset($aa_search);
14131411
unset($aa_replace);
@@ -1793,7 +1791,7 @@ function update($event_name, $data) {
17931791

17941792
//if proxy protocol is enabled we need to add a new port to lsiten to
17951793
if($web_config['vhost_proxy_protocol_enabled'] == 'y' && $data['new']['proxy_protocol'] == 'y'){
1796-
if((int)$web_config['vhost_proxy_protocol_http_port'] > 0) {
1794+
if(isset($web_config['vhost_proxy_protocol_http_port']) && (int)$web_config['vhost_proxy_protocol_http_port'] > 0) {
17971795
$tmp_vhost_arr['port'] = (int)$web_config['vhost_proxy_protocol_http_port'];
17981796
$tmp_vhost_arr['use_proxy_protocol'] = $data['new']['proxy_protocol'];
17991797
$vhosts[] = $tmp_vhost_arr;
@@ -1942,7 +1940,7 @@ function update($event_name, $data) {
19421940
unset($ht_file);
19431941

19441942
if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
1945-
if(trim($data['new']['stats_password']) != '') {
1943+
if(isset($data['new']['stats_password']) && trim($data['new']['stats_password']) != '') {
19461944
$htp_file = 'admin:'.trim($data['new']['stats_password']);
19471945
$app->system->web_folder_protection($data['new']['document_root'], false);
19481946
$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);

0 commit comments

Comments
 (0)