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 676603
In Process

The Archive Base Latest Questions

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

Today I run into some oddity with PHP, which I fail find a proper

  • 0

Today I run into some oddity with PHP, which I fail find a proper explanation for in the documentation. Consider the following code:

<?php
echo $_GET['t']. PHP_EOL;
?>

The code is simple – it takes a single t parameter on the url and outputs it back. So if you call it with test.php?t=%5Ca (%5c is a ‘\’), I expected to see:

\a

However, this is what I got:

$ curl http://localhost/~boaz/test.php?t=%5Ca
\\a

Notice the double slash. Can anyone explains what’s going on and give recipe for retrieving the strings as it was supplied on the URL?

Thanks,
Boaz

PS. I’m using PHP 5.2.11

  • 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-14T00:56:48+00:00Added an answer on May 14, 2026 at 12:56 am

    This happens, because you have the “magic quotes” switch in php.ini switched on. From the manual:

    When on, all ‘ (single-quote), ”
    (double quote), \ (backslash) and NULL
    characters are escaped with a
    backslash automatically. This is
    identical to what addslashes() does.

    Read more about it here: http://php.net/manual/en/security.magicquotes.php

    To make your script aware of any value of the “magic_quotes_gpc” setting in php.ini, you can write your script like this:

    $d = $_GET["d"];
    if (get_magic_quotes_gpc()) $d = stripslashes($d);
    echo $d; //but now you are kind of vulnerable to SQL injections
             //if you don't properly escape this value in SQL queries.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started today looking into Groovy. I consider using it to replace some
I ran into some code today that I found questionable. Here's a simplified example
Today I had to fix some older VB.NET 1.0 code which is using threads.
I ran into a weird situation today doing some one-time sql code. This nested
I'm developing a java application which will run on LAN, i do test today
I decided to modify some code today, and encountered an error that doesn't make
I run into a little problem today. I've a divbox. This divbox should expand
I ran into an odd bug today when I was running some unit tests
I'm still new to C++ so I daily run into new problems. Today came
I've run into a strange problem here: I created today a mousemove horizontal gallery.

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.