Skip to content

Commit 254a4af

Browse files
committed
- Fixed FS#2436: nginx + php-fpm: commented out custom php.ini settings get into pool config.
1 parent a5b1a01 commit 254a4af

File tree

2 files changed

+48
-40
lines changed

2 files changed

+48
-40
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,27 +2381,31 @@ private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$so
23812381
$ini_settings = explode("\n", $custom_php_ini_settings);
23822382
if(is_array($ini_settings) && !empty($ini_settings)){
23832383
foreach($ini_settings as $ini_setting){
2384-
list($key, $value) = explode('=', $ini_setting);
2385-
if($value){
2386-
$value = trim($value);
2387-
$key = trim($key);
2388-
switch (strtolower($value)) {
2389-
case '0':
2390-
// PHP-FPM might complain about invalid boolean value if you use 0
2391-
$value = 'off';
2392-
case '1':
2393-
case 'on':
2394-
case 'off':
2395-
case 'true':
2396-
case 'false':
2397-
case 'yes':
2398-
case 'no':
2399-
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
2400-
break;
2401-
default:
2402-
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
2403-
}
2384+
$ini_setting = trim($ini_setting);
2385+
if(substr($ini_setting,0,1) == ';') continue;
2386+
if(substr($ini_setting,0,1) == '#') continue;
2387+
if(substr($ini_setting,0,2) == '//') continue;
2388+
list($key, $value) = explode('=', $ini_setting);
2389+
if($value){
2390+
$value = trim($value);
2391+
$key = trim($key);
2392+
switch (strtolower($value)) {
2393+
case '0':
2394+
// PHP-FPM might complain about invalid boolean value if you use 0
2395+
$value = 'off';
2396+
case '1':
2397+
case 'on':
2398+
case 'off':
2399+
case 'true':
2400+
case 'false':
2401+
case 'yes':
2402+
case 'no':
2403+
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
2404+
break;
2405+
default:
2406+
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
24042407
}
2408+
}
24052409
}
24062410
}
24072411
}

server/plugins-available/nginx_plugin.inc.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,27 +1908,31 @@ private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$so
19081908
$ini_settings = explode("\n", $custom_php_ini_settings);
19091909
if(is_array($ini_settings) && !empty($ini_settings)){
19101910
foreach($ini_settings as $ini_setting){
1911-
list($key, $value) = explode('=', $ini_setting);
1912-
if($value){
1913-
$value = trim($value);
1914-
$key = trim($key);
1915-
switch (strtolower($value)) {
1916-
case '0':
1917-
// PHP-FPM might complain about invalid boolean value if you use 0
1918-
$value = 'off';
1919-
case '1':
1920-
case 'on':
1921-
case 'off':
1922-
case 'true':
1923-
case 'false':
1924-
case 'yes':
1925-
case 'no':
1926-
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
1927-
break;
1928-
default:
1929-
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
1930-
}
1911+
$ini_setting = trim($ini_setting);
1912+
if(substr($ini_setting,0,1) == ';') continue;
1913+
if(substr($ini_setting,0,1) == '#') continue;
1914+
if(substr($ini_setting,0,2) == '//') continue;
1915+
list($key, $value) = explode('=', $ini_setting);
1916+
if($value){
1917+
$value = trim($value);
1918+
$key = trim($key);
1919+
switch (strtolower($value)) {
1920+
case '0':
1921+
// PHP-FPM might complain about invalid boolean value if you use 0
1922+
$value = 'off';
1923+
case '1':
1924+
case 'on':
1925+
case 'off':
1926+
case 'true':
1927+
case 'false':
1928+
case 'yes':
1929+
case 'no':
1930+
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
1931+
break;
1932+
default:
1933+
$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
19311934
}
1935+
}
19321936
}
19331937
}
19341938
}

0 commit comments

Comments
 (0)