Keleth says:
... But as far as I can tell, prod is just taking the data and dumping it out in the same way, so why does it work? Why does prod work but a test on prod doesn't?
Given that mysql appears to be returning the correct data on both prod and staging (I get the same output shown in the screenshot above from both), and the php script turns it into garbage on both, it looks to be php related, especially since you noted that where angular was involved it displayed correctly [
ref].
If possible, can you spin up a container with newer php and see what your oneRunScripts/check_data.php does with that? Even if new php does not run the site, it will tell us if old php is doing this.
It may be a php setting in the container, and a fresh container with php8 (and no special config) would reveal some of that and tell us where to look next.