com php-src: Fixed Bug #75212 php_value acts like php _admin_value: sapi/fpm/fpm/fpm_php.c sapi/fpm/tes ts/023-bug72212.phpt sapi/fpm/tests/include
.inc

From: Date: Mon, 18 Sep 2017 16:08:51 +0000
Subject: com php-src: Fixed Bug #75212 php_value acts like php _admin_value: sapi/fpm/fpm/fpm_php.c sapi/fpm/tes ts/023-bug72212.phpt sapi/fpm/tests/include
.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99458@lists.php.net to get a copy of this message
Commit: cfc6c4d2973c795cb400435a28805a73c02d23e2 Author: Remi Collet <remi@php.net> Mon, 18 Sep 2017 18:08:51 +0200 Parents: 084e34098a44669b64a9e43fb598456136268cde Branches: PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cfc6c4d2973c795cb400435a28805a73c02d23e2 Log: Fixed Bug #75212 php_value acts like php_admin_value Bugs: https://bugs.php.net/75212 Changed paths: M sapi/fpm/fpm/fpm_php.c A sapi/fpm/tests/023-bug72212.phpt M sapi/fpm/tests/include.inc Diff: diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index e202769..11a5e25 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -38,7 +38,10 @@ static int fpm_php_zend_ini_alter_master(char *name, int name_length, char *new_ || ini_entry->on_modify(ini_entry, duplicate, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage) == SUCCESS) { ini_entry->value = duplicate; - ini_entry->modifiable = mode; + /* when mode == ZEND_INI_USER keep unchanged to allow ZEND_INI_PERDIR (.user.ini) */ + if (mode == ZEND_INI_SYSTEM) { + ini_entry->modifiable = mode; + } } else { zend_string_release(duplicate); } diff --git a/sapi/fpm/tests/023-bug72212.phpt b/sapi/fpm/tests/023-bug72212.phpt new file mode 100644 index 0000000..e601aaf --- /dev/null +++ b/sapi/fpm/tests/023-bug72212.phpt @@ -0,0 +1,82 @@ +--TEST-- +FPM: bug #75212 php_value acts like php_admin_value +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +include "include.inc"; + +$logfile = __DIR__.'/php-fpm.log.tmp'; +$srcfile = __DIR__.'/bug75212.php'; +$inifile = __DIR__.'/.user.ini'; +$port = 9000+PHP_INT_SIZE; + +$cfg = <<<EOT +[global] +error_log = $logfile +[unconfined] +listen = 127.0.0.1:$port +pm = dynamic +pm.max_children = 5 +pm.start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +php_admin_value[memory_limit]=32M +php_value[date.timezone]=Europe/London +EOT; + +$code = <<<EOT +<?php +echo "Test Start\n"; +var_dump(ini_get('memory_limit'), ini_get('date.timezone')); +echo "Test End\n"; +EOT; +file_put_contents($srcfile, $code); + +$ini = <<<EOT +memory_limit=64M +date.timezone=Europe/Paris + +EOT; +file_put_contents($inifile, $ini); + +$fpm = run_fpm($cfg, $tail); +if (is_resource($fpm)) { + fpm_display_log($tail, 2); + try { + $req = run_request('127.0.0.1', $port, $srcfile); + echo strstr($req, "Test Start"); + echo "Request ok\n"; + } catch (Exception $e) { + echo "Request error\n"; + } + proc_terminate($fpm); + fpm_display_log($tail, -1); + fclose($tail); + proc_close($fpm); +} + +?> +Done +--EXPECTF-- +[%s] NOTICE: fpm is running, pid %d +[%s] NOTICE: ready to handle connections +Test Start +string(3) "32M" +string(12) "Europe/Paris" +Test End + +Request ok +[%s] NOTICE: Terminating ... +[%s] NOTICE: exiting, bye-bye! +Done +--CLEAN-- +<?php + $logfile = __DIR__.'/php-fpm.log.tmp'; + $srcfile = __DIR__.'/bug75212.php'; + $inifile = __DIR__.'/.user.ini'; + @unlink($logfile); + @unlink($srcfile); + @unlink($inifile); +?> diff --git a/sapi/fpm/tests/include.inc b/sapi/fpm/tests/include.inc index 1e41957..dd2e69b 100644 --- a/sapi/fpm/tests/include.inc +++ b/sapi/fpm/tests/include.inc @@ -127,6 +127,7 @@ function run_request($host, $port, $uri='/ping', $query='', $headers=array()) { 'SERVER_NAME' => php_uname('n'), 'SERVER_PROTOCOL' => 'HTTP/1.1', 'CONTENT_TYPE' => '', + 'DOCUMENT_ROOT' => __DIR__, 'CONTENT_LENGTH' => 0 ), $headers); return $client->request($params, false)."\n";

« previous php.cvs (#99458) next »