Why is $\frac{\partial }{\partial \phi}(\frac{\partial^2 \phi}{\partial x^2})$ = 0?
I'm happy to read an article, but I don't know what keywords to search on.
Background: Apologies if this is a math question. The setup is physics and not sure if it's correct.
A text lists an example as $L=\frac{1}{2}(\partial _{\mu}\phi)^{2}-\frac{1}{2}m^{2}\phi^{2}$ and then asks for $\frac{\partial L}{\partial \phi}$. It lists the answer as $-m^{2}\phi$. The left-hand side of the equation, the d'Alembertian I believe, must have a derivative of 0, giving us the answer as the derivative of the right-hand side ($\frac{\partial }{\partial \phi}(\frac{1}{2}m^{2}\phi^{2}=-m^{2}\phi)$).
Why is the derivative of the d'Alembertian = 0? Expanding, it seems $\frac{\partial }{\partial \phi}\frac{1}{2}(\frac{\partial^2 \phi}{\partial x_{0}^2}-\frac{\partial^2 \phi}{\partial x_{1}^2}-\frac{\partial^2 \phi}{\partial x_{2}^2}-\frac{\partial^2 \phi}{\partial x_{3}^2})=0$.
Of course, the partial of a constant, or a variable that is not being differentiated with respect to, is 0. However, it seems to me all the terms depend on $\phi$, which is what we are differentiating with respect to. It probably has something to do with the chain rule of a first derivative applied to a second derivative, but I'm not clear how the chain rule works in that case. Further, I don't know what to search on.
Any help much appreciated!