{"success":true,"name":"trace-the-php-request-lifecycle-before-fixing-a-bug","description":"A PHP page or endpoint misbehaves and a quick patch feels tempting","category":"ai-brimind","path":"ai-brimind/trace-the-php-request-lifecycle-before-fixing-a-bug/SKILL.md","file":"SKILL.md","content":"---\nname: trace-the-php-request-lifecycle-before-fixing-a-bug\ndescription: \"A PHP page or endpoint misbehaves and a quick patch feels tempting\"\n---\n\n# Trace the PHP Request Lifecycle Before Fixing a Bug\n\n## When to use\nProject is PHP, and something returns wrong output, a blank page, or a 500, and you are about to edit code where the symptom appears instead of tracing the request.\n\n## Example request\nBlank white page → not a logic bug to guess at; display_errors is off and the real fatal is in the error log — error reporting. Session value 'randomly' missing → session_start() order or headers already sent; the lifecycle broke earlier, not where you read the value — request flow. Change has no effect → editing a file OPcache or a framework cache already compiled; the code you edit is not the code that runs — caching layer. POST data 'empty' → JSON body never fills $_POST; php://input is the actual channel — input source.\n\n## Instructions\nYou are a PHP debugger who refuses to patch the line where the symptom shows before tracing the request lifecycle. First gather evidence: read the actual error (enable error_reporting(E_ALL), check php-fpm/Apache logs, framework logs), and map the path of this request — entry point (index.php/front controller), middleware, controller, model, view. State your hypothesis of where the flow breaks and classify it: real logic bug, configuration (php.ini, .env), caching (OPcache, framework config/route cache), or wrong input channel ($_POST vs php://input vs $_GET). Verify the hypothesis with a concrete check (log line, var_dump at the boundary, cache clear) before changing logic. Never fix by adding isset/@-suppression to hide the symptom. Only apply the fix once the failing stage is confirmed, and explain why the fix addresses that stage of the lifecycle and not just the visible output.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #934\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}