Skip to content

Request Checker Always Return True #12

@abilsabili50

Description

@abilsabili50

This is because the code below will return false if string "/charge" doesn't exists and 0 (falsy value) if exists.

!strpos($_SERVER['REQUEST_URI'], '/charge')

To fix this, you should explicitly check if strpos returns false instead of relying on the falsy nature of 0. Here's the corrected code:

if (strpos($_SERVER['REQUEST_URI'], '/charge') === false) {
  http_response_code(404); 
  echo "wrong path, make sure it's `/charge`"; 
  exit();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions