简体   繁体   中英

PHP auto-assigning query string variables without me doing anything

I came across this when I realized I had a script that was working, but shouldn't be . I tested it by making a one line script as follows:

<?php
echo "<br>lang - $lang"; 
?>

When I run the script with query string ?lang=japanese it outputs:

lang - japanese

What the hell? No $_GET or $_REQUEST statements or anything but that one line. How is this happening???

Like Pekka said, it is likely you have register_globals turned on in your configuration. This is usually regarded as a security risk and should be turned off.

The feature itself was actually removed as of PHP 5.4.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM