Files
gravity/hosxp-webservice/.agents/AGENTS.md
T
2026-09-16 23:20:08 +07:00

1.0 KiB

Coding Rules for HOSxP Web Service

  1. PHP 8.1 Strict Types: This project runs on PHP 8.1+. Functions like substr, explode, and count will throw Fatal Errors (TypeError) if passed null. Always check for null or provide fallbacks (e.g., $var ?? '') when dealing with database fields that might be NULL (like nexttime in oapp).
  2. MySQLi Report Mode: The codebase relies on legacy behavior where mysqli_query returns false on failure, rather than throwing Exceptions. Ensure mysqli_report(MYSQLI_REPORT_OFF); is maintained, and do NOT enable MYSQLI_REPORT_STRICT, as it will cause cascading 500 errors across the application.
  3. Variable Scope & Require_Once: Never place require_once for configuration files (like db.php) inside functions or conditional local scopes unless returning the variables. Doing so traps the variables (like $conn1) in the local scope, preventing them from being accessible in the global scope during subsequent includes, leading to Undefined variable errors.