在Exception跟踪中显示的整个CI超级对象

hope someone can help with this.

Whenever I print_r an Exception thrown in my Codeigniter site, the entire CI 'super object' shows up in the trace. I wouldn't care too much, since I won't normally be printing out the Exception for users to see, but my concern is sensitive information is in the trace. For example, my DB username and password, session Id, and encryption key, along with other trivial things like the entire calendar class, or the entire pagination class. along with these security concerns, the mere length of the exception can make it hard/annoying to troubleshoot, and find the info i actually care about.

i don't know enough about Exceptions to know if this is a bug or a feature, so I'm hoping someone can shed some light on this. If I have no luck here, I'll probably submit it as an issue on CI's github.

thanks for the help.

You might want to consider using print_r() to output to the server's error log instead of the browser. You can do this using the error_log() function like below:

error_log(print_r($your_exception_here, true));

The second true parameter on print_r() makes it return a string instead of outputting straight to the browser automatically.

This obviously means you have to check your error log instead of a quick look in the browser, but the extra step is probably worth it for the security and/or user experience.