Old 09-20-2007, 10:28 AM   #1
Junior Member
 
Join Date: Sep 2007
Posts: 3
Ed Lynn is on a distinguished road
Default Extra element in $_GET

Using prototype and scriptaculous compressed, and doing an ajax.request, i get a random underscore in the $_GET superglobal. Has anyone seen this and know why its there please?

Cheers
Ed Lynn is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-20-2007, 11:51 AM   #2
Runs This Show
 
Steve's Avatar
 
Join Date: Dec 2006
Posts: 182
Steve has disabled reputation
Default Re: Extra element in $_GET

I've never seen that before. Where in the request is it ending up? Appended to the end? Or somewhere in the middle? Can you provide an example page?
Steve is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-21-2007, 03:39 AM   #3
Junior Member
 
Join Date: Sep 2007
Posts: 3
Ed Lynn is on a distinguished road
Default Re: Extra element in $_GET

It ends up as the last element in the $_GET global.

The url of the recieving page doesnt contain anything interesting...

'/scripts/ajax_validation.php'

var_dump of $_GET...

'fieldValue' => string 'sdjdj*' (length=6)
'param0' => string 'validate_none' (length=13)
'param1' => string 'ValidatorRuleNotNull' (length=20)
'param2' => string 'validatorRegEx_p13n' (length=19)
'_' => string '' (length=0)

The parameters passed in the ajax.request...

fieldValue=fsjmfj*&param0=validate_none&param1=Val idatorRuleNotNull&param2=validatorRegEx_p13n

Cheers. Hope i can get this working as it's a great idea doing what you are with this.
Ed Lynn is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-21-2007, 06:19 AM   #4
Runs This Show
 
Steve's Avatar
 
Join Date: Dec 2006
Posts: 182
Steve has disabled reputation
Default Re: Extra element in $_GET

Hmph. I rarely actually dump the $_GET variable or iterate through it. I typically use the parameters that I'm sending by name.

Security wise, you should be ignoring any unrecognized GET or POST parameters, or perhaps failing when you see ones that you aren't expecting. But who knows, that could be exactly how you found this problem.

I'm a little tied up today, but if I get a chance at lunch I'll try to re-create the problem and troubleshoot.

What's strange is that it's declaring the variable, but not actually putting anything in there. I've used the compressed libraries extensively and I'm always using ajax and I have never noticed the problem. In most situations I'm posting data, though. I can't think of any code I've written off the top of my head that uses GET.

Anyhow, I'll get back to you at some point today with my progress.
Steve is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-21-2007, 06:42 AM   #5
Junior Member
 
Join Date: Sep 2007
Posts: 3
Ed Lynn is on a distinguished road
Default Re: Extra element in $_GET

Thanks Steve.

That is pretty much how i came across the problem sure. I was expecting to see only fieldValue and then a variable number of param[int] elements. Having the underscore in there caused the code to fail.

Thanks for yuor help
Ed Lynn is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-23-2007, 05:43 PM   #6
Runs This Show
 
Steve's Avatar
 
Join Date: Dec 2006
Posts: 182
Steve has disabled reputation
Default Re: Extra element in $_GET

I haven't forgotten about you, but I did get caught up in some other things. Sorry. Hopefully I'll get back to you this evening sometime.
Steve is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 09-24-2007, 01:21 PM   #7
Runs This Show
 
Steve's Avatar
 
Join Date: Dec 2006
Posts: 182
Steve has disabled reputation
Default Re: Extra element in $_GET

I've tested 6 versions of the compressed prototype library -

PHP Code:
<!--<script type="text/javascript" src="http://www.stevekallestad.com/downloads/prototype-150-compressed.js"></script>-->
<!--<script type="text/javascript" src="http://www.stevekallestad.com/downloads/sc-17-proto-15-compressed.js"></script>-->
<!--<script type="text/javascript" src="http://www.stevekallestad.com/downloads/proto-15-sc-b-and-e-17-compressed.js"></script>-->
<!--<script type="text/javascript" src="http://www.stevekallestad.com/downloads/sc-17-proto-15-compressed.js></script>-->
<!--<script type="text/javascript" src="http://www.stevekallestad.com/downloads/sc71b-pbe-combo-compactb.js"></script>-->
<script type="text/javascript" src="http://www.stevekallestad.com/downloads/sc171b-combob.js"></script> 
And I don't see the problem with any of them.

I created a simple test page. You can view the source here. I even linked against the downloads directly - although for the 171 beta files, I had to use new links. Apparently I have an unwelcome line break in the originals.

Using firebug as well, I don't see any problems with the requests at all.

I wonder if this may have something to do with the character set you are using. Perhaps try out something like this:
PHP Code:
<script type="text/javascript" src="sourcefile" charset="ISO-8859-1"></script> 
Or perhaps you aren't using any of the files I tried out. I know there have been a lot of different versions posted over the last year, but I tried to keep track of all of them. Maybe you can post a link to an HyperText Meta Language file that exhibits the problem.
Steve is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug: Footer Element in IE Steve Support 1 02-18-2007 03:32 PM
Discussion: Lawrence Livermoore Discovers Element 118 (again) MT Integration Article Talk 0 02-07-2007 06:42 PM


All times are GMT -7. The time now is 07:44 PM.