So they've added malloc fail checks and tests for malloc fail throughout.

Is this even reachable on Linux due to overcommit? Maybe by attempting a single extremely large allocation?

PHP is tracking its own memory usage internally with limits configurable via php.ini.