FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » who is changing dots into underscores in my variable names in REST?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: who is changing dots into underscores in my variable names in REST? [message #169714 is a reply to message #169704] Thu, 23 September 2010 19:38 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(jrobinss)

> I searched high and low for a precise answer to this question, and
> haven't found, so here goes.
>
> I have a REST web service written in PHP (installation: Wamp with PHP
> 5.3.0).
> Whether it receives
> http://foo.bar/service?first.second=glob
> or else
> http://foo.bar/service?first_second=glob
> it does exactly the same: it thinks it's receiving first_second.
>
> Basically, dots are changed into underscores in the variable name
> before being dispatched.

It's a relic in PHP from the old days of register_globals. When you have
a parameter named 'foo', it would have ended up as a global variable of
the same name. But some characters are not allowed in variable names,
hence they were replaced with underscores. I don't know if there is or
will be a way to disable this "feature", since it's not needed anymore.

> This is what I found...
>
> http://php.net/manual/en/reserved.variables.get.php
> "The GET variables are passed through urldecode(). "

See the second note and the section "Dots in incoming variable names" on
<http://www.php.net/manual/en/language.variables.external.php>.

Micha
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What's in this cookie?
Next Topic: Re: Can anyone recommend a good debugger & IDE for PHP?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 09:07:14 GMT 2024

Total time taken to generate the page: 0.05987 seconds