I’d replace the post.
The foam might work for a hot minute but I’m not even convinced of that. I’d think the stress from the weight of the gate will cause it to fail rather quickly.
If the hollow is up in an area where the hinges attach you might split the post with the foam expanding as it cures.
I’ve had only 1 interaction with DeWalt so far on a defective battery that was still under warranty and was actually impressed.
Used the contact form and exchanged 2 or 3 emails with service rep on a Saturday and had a new battery the following week