Back to gallery

Coding

PHP Debugging Investigation

Diagnose a PHP failure with ranked hypotheses, safe checks, and a minimal repair path.

Models
DeepSeek, ChatGPT
Level
Advanced
Version
v0.9

Published by HiddenPrompts · Published · Updated

Editorial template. Model evaluation is not recorded; the preview illustrates the intended result. Testing Method

01

What this prompt does

Diagnose a PHP failure with ranked hypotheses, safe checks, and a minimal repair path.

02

Best for

Symptom summary, likely causes ranked by evidence, verification commands, minimal patch, regression checks, and rollback note.

03

Prompt variables

[ERROR][CODE][ENVIRONMENT][EXPECTED_BEHAVIOR]
System Prompt
You are a senior PHP production engineer. Diagnose before changing code and do not invent runtime evidence.
User Prompt
OBJECTIVE:
Investigate [ERROR] in [CODE] running in [ENVIRONMENT]. Expected behavior: [EXPECTED_BEHAVIOR].

INPUTS:
ERROR: [ERROR]
CODE: [CODE]
ENVIRONMENT: [ENVIRONMENT]
EXPECTED_BEHAVIOR: [EXPECTED_BEHAVIOR]

OUTPUT CONTRACT:
Symptom summary, likely causes ranked by evidence, verification commands, minimal patch, regression checks, and rollback note.

How to use

Reproduce the failure with the smallest relevant route and sanitized input. State the exact runtime and expected error contract. Ask the assistant to separate confirmed facts from possible causes and to propose one narrow change. Run boundary cases yourself, checking response status and side effects as well as whether the error disappeared.

Why it works

The blueprint separates authority, task context, evidence limits, and the output contract so requirements can be checked independently.

Model compatibility

ChatGPTuntestedEditorial compatibility hypothesis; cross-model test record pending.

DeepSeekuntestedEditorial compatibility hypothesis; cross-model test record pending.

Authored teaching example, not a recorded model response.

05

Example input

ERROR: Numeric formatting fails for a nonnumeric input
CODE: Request price is passed directly to number_format
ENVIRONMENT: PHP; provide exact deployed version during a real investigation
EXPECTED_BEHAVIOR: Invalid price returns a controlled validation error without a write

06

Example output

Hypothesis: Unvalidated request data reaches a numeric formatter.
Evidence to confirm: capture the sanitized value and type at the formatting boundary.
Candidate correction: validate accepted representation and range before formatting; do not cast invalid input to zero.
Verification cases: positive value, zero, empty, array, missing field and nonnumeric string.
Status: This is an authored investigation plan, not an executed fix.

How to customize

For a database issue, add the sanitized statement, parameter types and relevant schema. For a worker issue, add the actual launch method and process exit information. Keep unrelated environment credentials out of the prompt.

Common mistakes

Do not paste production secrets or an entire log with customer information. A proposed patch is not a tested patch. Silently coercing invalid input may hide the bug instead of fixing the contract.

Test notes

Editorial blueprint awaiting recorded cross-model evaluation. It is visible for review but is not labeled as tested.

Why is this blueprint not marked as tested?

It has passed editorial structure review but does not yet have a published cross-model test record.