PHP Bug Hunt Hard +35 XP
Session Not Started
Session data is not saved.
PHPFind the bug
1
$_SESSION["user"] = "Alice";2
session_start(); The bug is on line 1
Select the correct fix
Show answer and explanation
Answer: Call session_start() before setting session data
session_start() must be called before any session data is accessed or set, and before any output is sent.
Hint: Sessions must be started before use.
What this challenge tests
Bug Hunt in PHP: sessions, php.