views:

203

answers:

1

Greetings,

I am trying to debug a login script. So I decided to use var_ dump to print out the password. But for some reason say If I type in 'BOSTON' rather then printing 'BOSTON' it prints out six dashes, 1 dash for each character. I haven't encountered it like this before. I'm sure i'm missing something. I tried ob_ start() var_ dump then ob_ get_clean but it doesn't print anything that way. I thank the community in advance.

 var_dump($_POST['pass_field']); // password BOSTON

output:

 string(6) "------"
+3  A: 

I would use the print_r function on the $_POST array to see if the pass_field key is set to BOSTON

print_r($_POST);

If you want to use ob_start(), you must get the content then end it

ob_start();
var_dump($_POST['pass_field'];
print_r($_POST);
$content = ob_get_contents();
ob_end_clean();

echo $content;

I hope that helps.

philhq
are you suggesting that output print_r would show different value form var_dump?
SilentGhost
Thanks a lot! That did it, I was able to see a hidden field that I had overlooked, by printing all the content like you said;
Marin
@SilentGhost var_dump and print_r should show more-or-less the same info here. The important bit was that he was printing the whole $_POST array and not just one of the array elements.
fiXedd
@SilentGhost no I'm not, I was simply suggesting to use the print_r function instead of var_dump to see if there were any errors or hidden values that may cause his problem
philhq
You can also skip the output buffering (ob_start() bit) by just using print_r($_POST, true) - the second parameter being true means return the data as output from the function instead of sending it to the output stream.
Dustin Fineout