0

We have Java code that creates a GET request using logic such as:

String getReq = "&aParam=" + URLEncoder.encode("valueWithSubstring", "UTF-8");

Then our PHP based reporting system reads this and tries to filter for certain values. The problem is that for whatever reason in some cases they seem to pass through when they shouldn't. The PHP filtering code at it's most basic is:

if(strpos($_GET['aParam'], 'substringToFilter') !== false)
    die();

But for whatever reason the substringToFilter doesn't seem to filter the requests...

Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192

1 Answers1

4

When you use UTF-8 encoding use mb_* functions:

mb_strpos

Note: mb_strpos vs strpos, what's the difference?

Community
  • 1
  • 1
ImmortalPC
  • 1,650
  • 1
  • 13
  • 17
  • I still haven't found the answer but I marked this as the answer because it definitely had an impact. It resolved one of the issues. – Stephane Grenier Jul 25 '14 at 12:13