For vector shape tools (checked tools: Rectangle Tool, Polygon Tool) when you fill the outline with a gradient, the color of the gradient change also the current Background color, which leads to the change of the fill of the shape.
STEPS TO REPRODUCE
1. Choose two different colors for background and foreground colors.
2. Create a new shape.
3. Select the Select Shapes Tool.
4. Select the shape.
5. In Tool Options change the color of the outline to gradient (it helps if the gradient presented there has a distinctive color; to achieve this without influencing the current triaging, just do step 5., deselect the shape, change the color of the gradient to something like hot pink or hot green and start with step 1. again).
5a. Make sure the gradient preset chosen is the simple "Foreground color to transparency". It's also important to make sure that the color of the saved gradient (the color presented below the line, not above) is different from the current fill color.
6. If you don't see the result yet, change it to the Solid color and then again to the Gradient.
Foreground color change to the color of the gradient.
The fill of the shape is changed to the foreground color ( = color of the gradient).
Note: after changing the color of the line to "Solid" again, the fill color doesn't change to the correct, previous color (as it was before changing to Gradient).
No change in the fill of the shape.
(Change in the Foreground color doesn't matter to me, but it clearly trigger the change in the fill which is undesired).
You need to do 2 undos to undo this change: first undo changes the fill color to the correct, previous color, the second undo changes the outline to the Solid color again.
it sounds like Bug 399127. Is it the same issue?
Yes, of course. I don't know how I missed that.
*** This bug has been marked as a duplicate of bug 399127 ***