Tuesday, February 16, 2010

A PHP Never Ceases To Amaze Moment

Did you know that PHP had an init variable named auto_prepend_file? The docs say:

Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require() function, so include_path is used.

In other words, you can arrange for some code to be evaluate before any file is intepreted by PHP. It seems like a clever (and dangerous) hook to inject functionality that doesn't appear to be written into a PHP file.

I learned about this little goodie by stumbling on this article that talks about logging POST data.

I'm not sure when I'd use this, and I'd probably be pretty thrown off if I ever came across a codebase that was leveraging it -- but still, it makes me wonder.

No comments:

Post a Comment