TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

December 11, 2024, 04:11:57 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,443
  • Total Topics: 21,252
  • Online today: 101
  • Online ever: 6,457 (November 30, 2024, 02:40:09 PM)
Users Online
  • Users: 0
  • Guests: 107
  • Total: 107

Possible escape issue in searches

Started by MrMike, October 10, 2023, 09:06:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

Let's just use built in PHP functions... that'll hopefully point where the issue lies.

$mysqli = mysqli_init();
$what = mysqli_real_escape_string($mysqli, $what);

@rjen

Put it in the second spot: still no change


$what = implode(' ',$words);
$mysqli = mysqli_init();
$what = mysqli_real_escape_string($mysqli, $what);
}

Put it in the first spot: HTTP ERROR 500
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino


@rjen

Just did  aquick test, and it works: searching does no longer results in errors, and the ' symbols are included in the search string.

putting 'test' in an article text and 'test' in another

Search for the string test results in hits on the string test without quotes only
Search for the string 'test' results in hits on the string 'test' with quotes only

I assume this is how we want this to work?

Asking this because it reacts slightly differently when putting it in the article TITLE...

putting 'test' in an article title

Search for the string test results in hits on both the strings: test without quotes and the 'test' with quotes
Search for the string 'test' results in hits on the string 'test' with quotes only
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

It should be a wildcard search so test or 'test' will be returned.

That does depend on your character encoding and database. Not much we can do to change those