Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7059579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:14:56+00:00 2026-05-28T04:14:56+00:00

I tested this query in my database, and it works fine: select * from

  • 0

I tested this query in my database, and it works fine:

select * from variables where value = 'commas-:-)';

I get a result. Now, I stored the value in a variable and use the query class.

$value = 'commas-:-)' <<< this is passed as a parameter

$query = "select * from variables where value = '$value'";
$this->db->query($query);

Now, this query works for every other value except for this one – but what’s odd is that if I PRINT out the exact query (print_r of $query) and execute it on the database, it returns the correct result. So I’m left to think that the query class is screwing with my query, which it shouldn’t because everything is properly escaped and $value is a string literal.

What is going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:14:57+00:00Added an answer on May 28, 2026 at 4:14 am

    I found the issue – it was the rerouting function that was causing the mishap. More specifically, the segment filtering function within the route folder in the system core.

    This is what happened:

    I created an anchor with the encoded value (commas:-)) and I configured the route to reroute the uri to a function I had in my controller. Each time I clicked the link, the value gets passed, and (supposedly) rerouted to the function. Which it did, for almost all the values I used. Except this one.

    1st assumption: the db query function is escaping the values. But I turned off the escape, as well as checked the query by printing. The value was correct. I then tried other query formats, and still no results. Conclusion: There’s nothing wrong with the database query functions.

    2nd assumption: the data must be corrupt – although the value is correct (I’m getting commas:-)), it’s not returning anything except when I type in the value manually. So I tested this:
    I created a seperate value, and set it equals to the one I typed in(the one that works). I then printed the original value(one passed) and the newly created value using VAR_DUMP.
    Turns out, the argument value (one that doesn’t work) is a string with length 14 whereas my new variable was a string with a length of 10. WTF? Conclusion: Something occured during the rerouting / passing process that changed the variable.

    I went back to the config folder, and replace the variable $i in the reroute to the literal string value commas:-). And guess what? It worked perfectly. And just to make sure it wasn’t the regex, I wrote my own custom regex and it matched fine, but the value was still being changed. So I decided to get under the hood.

    I traced the URI manipulation in the routes class to the _explode_segment() function, which was used to perform the regex and analyse the uri for other variables. It also did this thing …

    _filter_uri($str)

    for each part of the uri segment that was matched.

    What did it do? It replaces programmable characters like ( and ) with their HTML ENTITY. Now, if you don’t know, html entities have long lengths than url encoding. LOL. So what happened was this:

    Original segment : commas-%3A-%29 <- very nice!
    Filtered segment : commas-%3A-) <- NOOOOOOOOO! (the right paren encoded with &#41.)

    urldecode(“&#41”) = string(4)
    urldecode(“%29”) = string(1)

    Fail.

    or WIN?!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this particular query works, as I tested it with unprepared, procedural methods.
I have tested this servlet and it works well, except in Google Chrome it
I just tested this simple php file upload script. Works in all browsers except
Let me explain. I have a simple query which works when I tested it
I have a database checkpoint in QTP (HP QuickTest Pro); this checkpoint works if
Edit: If you're coming here from Google, this issue is a result of the
I'm using VSC++ and MySQL ver.5.2.25 database, I've tested a query In MySQL that
I want to my array, somthing like this: array(userid=>username,1=>ganeshfriends,2=>tester) mysql query something like this:
I have this regex I built and tested in regex buddy. _ [ 0-9]{10}+
I run into this quite often where a new page is supposedly tested and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.