php / php/php-src

FPM: php_value and php_admin_value entries are applied in reverse order [.phpt test included]

Offen
#13,249 2 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@bukka arbeitet bereits daran.

Seit 26.1.2024.

Bug SAPI: fpm
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.2k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

Description

The following FPM config:

[global]
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 5
php_value[memory_limit]=32M
php_value[memory_limit]=24M
php_admin_value[date.timezone]=Europe/London
php_admin_value[date.timezone]=Europe/Paris

Resulted in this php-fpm -tt output:

…
[26-Jan-2024 07:24:03] NOTICE: 	php_value[memory_limit] = 24M
[26-Jan-2024 07:24:03] NOTICE: 	php_value[memory_limit] = 32M
[26-Jan-2024 07:24:03] NOTICE: 	php_admin_value[date.timezone] = Europe/Paris
[26-Jan-2024 07:24:03] NOTICE: 	php_admin_value[date.timezone] = Europe/London

But I expected this output instead:

…
[26-Jan-2024 07:24:03] NOTICE: 	php_value[memory_limit] = 32M
[26-Jan-2024 07:24:03] NOTICE: 	php_value[memory_limit] = 24M
[26-Jan-2024 07:24:03] NOTICE: 	php_admin_value[date.timezone] = Europe/London
[26-Jan-2024 07:24:03] NOTICE: 	php_admin_value[date.timezone] = Europe/Paris

[!NOTE]
This is not just cosmetic ordering in php-fpm -tt; the values are also applied in this order as INI directives, so ini_get() will return 32M and Europe/London instead of the expected 24M and Europe/Paris.


PHPT:

<?php // this is just for GitHub syntax coloring ?>
--TEST--
FPM: GH-13249 - php_value and php_admin_value entries are applied in reverse order
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php

require_once "tester.inc";

$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 5
php_value[memory_limit]=32M
php_value[memory_limit]=24M
php_admin_value[date.timezone]=Europe/London
php_admin_value[date.timezone]=Europe/Paris
EOT;

$code = <<<EOT
<?php
echo "Test Start\n";
var_dump(ini_get('memory_limit'), ini_get('date.timezone'));
echo "Test End\n";
EOT;

$tester = new FPM\Tester($cfg, $code);
$tester->start();
$tester->expectLogStartNotices();
$tester->request()->expectBody([
    'Test Start',
    'string(3) "24M"',
    'string(12) "Europe/Paris"',
    'Test End'
]);
$tester->terminate();
$tester->close();

?>
Done
--EXPECT--
Done
--CLEAN--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>

Test log:

---- EXPECTED OUTPUT
Done
---- ACTUAL OUTPUT
>>> Response
----------------- OUT -----------------
X-Powered-By: PHP/8.3.2
Content-type: text/html; charset=UTF-8

Test Start
string(3) "32M"
string(13) "Europe/London"
Test End

----------------- ERR -----------------

---------------------------------------

ERROR: ==> The expected body:
Test Start
string(3) "24M"
string(12) "Europe/Paris"
Test End
==> does not match the actual body:
Test Start
string(3) "32M"
string(13) "Europe/London"
Test End

LOGS:
--------------------------------------------------------------------
[26-Jan-2024 08:55:34] NOTICE: fpm is running, pid 62872
[26-Jan-2024 08:55:34] NOTICE: ready to handle connections
--------------------------------------------------------------------

Done
---- FAILED
PHP Version

PHP 8.3.2

Operating System

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.