Bird
0
0

Why is relying on $_REQUEST sometimes discouraged in PHP applications?

hard📝 Conceptual Q10 of 15
PHP - Superglobals and Web Context
Why is relying on $_REQUEST sometimes discouraged in PHP applications?
ABecause it requires manual initialization
BBecause it does not contain any user input
CBecause it only works with GET requests
DBecause it can lead to security issues due to mixed input sources
Step-by-Step Solution
Solution:
  1. Step 1: Understand the nature of $_REQUEST

    $_REQUEST mixes GET, POST, and COOKIE data, which can cause confusion about the source of input.
  2. Step 2: Identify security concerns

    This mixing can lead to security risks if the source is not verified, allowing unexpected data to override expected values.
  3. Final Answer:

    Because it can lead to security issues due to mixed input sources -> Option D
  4. Quick Check:

    Mixed input sources in $_REQUEST can cause security risks [OK]
Quick Trick: Avoid $_REQUEST to prevent input source confusion [OK]
Common Mistakes:
  • Thinking $_REQUEST is safer than $_GET or $_POST
  • Assuming $_REQUEST excludes cookies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes