Skip to content

fix: handle missing sign parameter in EPay notify callback#852

Open
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/epay-notify-missing-sign
Open

fix: handle missing sign parameter in EPay notify callback#852
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/epay-notify-missing-sign

Conversation

@onesyue
Copy link
Copy Markdown

@onesyue onesyue commented Apr 1, 2026

Summary

  • PHP 8 throws ErrorException: Undefined array key "sign" when accessing $params['sign'] on an empty/incomplete POST body
  • When the payment callback POST body is lost through CDN/proxy layers (e.g., Cloudflare forwarding, reverse proxy misconfiguration), $request->input() returns an empty array
  • This causes a 500 error response, and the payment gateway interprets it as a failure and retries indefinitely
  • Fix: use null coalescing operator (??) and return false early to gracefully reject invalid callbacks

Changes

plugins/Epay/Plugin.php line 82:

// Before
$sign = $params['sign'];

// After
$sign = $params['sign'] ?? null;
if (!$sign) return false;

Test plan

  • Verify normal EPay payment callback still works (sign present and valid)
  • Verify callback with empty POST body returns false instead of 500
  • Verify callback with missing sign key returns false instead of throwing exception

🤖 Generated with Claude Code

PHP 8 throws ErrorException for undefined array keys. When the POST
body is lost through CDN/proxy layers (e.g., Cloudflare), the request
input may be empty, causing $params['sign'] to throw an exception.
This results in 500 errors and the payment gateway retrying indefinitely.

Use null coalescing operator and return false early to gracefully reject
invalid callbacks without triggering an exception.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant