Skip to content
Free since 2014. Built for the engineers who keep things running.

cat /articles/your-api-key-is-in-your-stack-trace.md

PHP

Your API Key Is in Your Stack Trace

A PHP setting can cause exception stack traces to keep the arguments passed to each function, so an API key used in an SDK call may end up in logged errors. The piece covers how keys leak and how to prevent it.

juststeveking.com20 Nov 2026 · 1 min read · summary

article --summary

The summary

The article explains that when a particular PHP configuration option is enabled, every frame in an exception's backtrace retains the arguments that were passed into it. If an SDK function receives an authenticated request containing an API key, that secret can travel along with the trace whenever the error is recorded or displayed. The author looks at the common routes by which keys end up exposed, and why production environments often hide the problem while development setups reveal it. Readers come away with a clearer picture of where the leak happens in their own code and dependencies. The piece closes with practical steps to stop secrets from appearing in traces, such as adjusting the relevant setting and keeping credentials out of places where errors get logged.

Editorial note: This is a summary of an article first published by juststeveking.com. The full piece is on their site.

Reading now

Topic
PHP
Source
juststeveking.com
Published
20 Nov 2026
Format
Curated summary

Have a take on this?

Write it up and submit it. It goes on the list once an editor approves it.

Submit an article

articles --latest

Latest articles

New from the blogs we follow and the community.

All articles

newsletter --weekly

LaraChat Weekly, minus the noise.

The best reads, new jobs and upcoming events, in one email a week.