php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68024 INI/ENV settings get prepended instead of appended
Submitted: 2014-09-16 08:50 UTC Modified: 2017-01-29 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: manuel-php at mausz dot at Assigned:
Status: No Feedback Package: FPM related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: manuel-php at mausz dot at
New email:
PHP Version: OS:

 

 [2014-09-16 08:50 UTC] manuel-php at mausz dot at
Description:
------------
During parsing the config FPM files FPM prepends new settings instead of appending (or replacing) them. This way it's impossible to override a previously defined setting. e.g. overriding a global setting with a pool specific.
The only way this is possible is to define the setting before including global settings, which is somewhat unexpected behavior. Additional this behavior only applies to environment variables and INI settings.

Test script:
---------------
# cat fpm.d/test.conf
[test]
prefix = /var/www/$pool
user = $pool
pm = ondemand
env[TMP] = foo
env[TMP] = bar

Expected result:
----------------
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = foo
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = bar


Actual result:
--------------
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = bar
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = foo


Patches

master-fpm-append-settings.patch (last revision 2014-09-16 08:51 UTC by manuel-php at mausz dot at)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-16 08:59 UTC] manuel-php at mausz dot at
The attached patch works around this by appending the setting at the end of the key-value list. I've modified the linked list so it's a circular double linked list with the exception that the tail is not linked to the head (but head to tail). This way appending is still fast and there are no changes to the traversals.

An alternative approach would be to replace the list with a Zend HashTable.

I can also create a pull request on GitHub if that's preferred.
 [2014-10-09 01:54 UTC] datibbaw@php.net
Thanks for the proposed patch, but abusing a doubly linked list is scary stuff, so I've opted to add a simple structure to keep track of both head and tail.
 [2017-01-15 07:15 UTC] krakjoe@php.net
-Status: Open +Status: Feedback
 [2017-01-15 07:15 UTC] krakjoe@php.net
We are awaiting a new patch for supported version of PHP, as mentioned in the (closed) PR.
 [2017-01-29 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC