Skip to content
Permalink
Browse files

Fixed Bug #75212 php_value acts like php_admin_value

  • Loading branch information...
remicollet committed Sep 18, 2017
1 parent 084e340 commit cfc6c4d2973c795cb400435a28805a73c02d23e2
Showing with 87 additions and 1 deletion.
  1. +4 −1 sapi/fpm/fpm/fpm_php.c
  2. +82 −0 sapi/fpm/tests/023-bug72212.phpt
  3. +1 −0 sapi/fpm/tests/include.inc
@@ -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);
}
@@ -0,0 +1,82 @@
--TEST--

This comment has been minimized.

Copy link
@bukka

bukka Sep 18, 2017

Member

@remicollet I just realized that there is already 023 ( https://github.com/php/php-src/blob/cfc6c4d2973c795cb400435a28805a73c02d23e2/sapi/fpm/tests/023.phpt ) so it should be probably 024 :)

I guess it might be better to drop the numbering for bugs and just name it as bug.phpt if it's a bug like it is everywhere else...

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);
?>
@@ -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";

0 comments on commit cfc6c4d

Please sign in to comment.
You can’t perform that action at this time.