Jump to content

import_request_variables acting funny

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts
ok

<?php

error_reporting(E_ALL ^ E_NOTICE);

//error_reporting(E_ALL); // FIXME: kaanna pois paalta

var_dump($_GET);

var_dump($_POST);

var_dump($_COOKIE);

$res_var = @import_request_variables("gpc", "");

if($res_var == false)

	echo "gas";

else

	echo "gassu";



and here's output:


array
'asty' => string 'no' (length=2)
'yrid' => string '' (length=0)
'yid' => string '64' (length=2)
'kirjain' => string '' (length=0)

array
'poista' => string 'KysyPoista' (length=10)
'poista_x' => string '6' (length=1)
'poista_y' => string '6' (length=1)

array
'PHPSESSID' => string '5d2ccf01786dd578b9cb7e3b2362fcbb' (length=32)

gas


so the questin arises: why does it return false?
It does what is asked of it .. all the get/post/cookie variables are converted

Any thoughts ?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Well, it looks like "gpc" isn't a request variable, so it defaults to "" which is interpreted as false.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

WingedPanther said:

Well, it looks like "gpc" isn't a request variable, so it defaults to "" which is interpreted as false.

I don't get it .. gpc = get post cookie
Should be kosher
shouldn't be case-sensitive either

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
This site may help: PHP: import_request_variables - Manual
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

WingedPanther said:


yeah, checked that one
a few times in fact
letter by letter :)

#6
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Try adding a prefix and see if that changes anything. Maybe you don't have the most up to date PHP version? It is optional but not suggested so you technically shouldn't be using it anyways.

Of try something like:

foreach($_GET as $id => $key) {
	$pre_$id = $key;
}
foreach($_POST as $id => $key) {
	$pre_$id = $key;
}
foreach($_COOKIE as $id => $key) {
	$pre_$id = $key;
}
Untested but should do the same thing as the function.


Finally a reason for variable variables!!

#7
Guest_Jordan_*

Guest_Jordan_*
  • Guests
What does

print_r($res_var);

return?

#8
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

Jordan said:

What does


print_r($res_var);


return?

nothing

#9
denarced

denarced

    Programmer

  • Members
  • PipPipPipPip
  • 182 posts

BlaineSch said:

Try adding a prefix and see if that changes anything. Maybe you don't have the most up to date PHP version? It is optional but not suggested so you technically shouldn't be using it anyways.

the @-prefix makes no difference
my LAMP is ubuntu 9.04 jaunty and everything's from repos
****
well I guess this will remain a mystery