Im annoyed.
I’m passing a variable from a Controller method to Method and somehow it is getting changed in the transfer. Originally it was stupidly called $id .. so I thought there could be some variable interference going on.. but I have changed the name and the problem persists.
Can anyone tell me what may be happening?
Here is the code .. check my comments
public function firstFbLogin()
{
ChromePhp::log('AJAX - first FB login'); // logs fine
$username = $this->input->post('username');
$first_name = $this->input->post('first_name');
$last_name = $this->input->post('last_name');
$facebookId = $this->input->post('facebookId');
$email = $this->input->post('email');
$third_party_id = $this->input->post('third_party_id');
$gender = $this->input->post('gender');
$this->Member_model->mFirstFbLogin($username, $first_name, $last_name, $email, $facebookId, $third_party_id, $gender);
// here comes the issue..
$idFromFbDooDaDay = $this->Member_model->mFetchIdFromFacebook($facebookId);
ChromePhp::log("Id found and going out of ajax - firstFbLogin is ". $idFromFbDooDaDay); // <<< this logs 232 which is what I am expecting
$this->Member_model->mCreateProfilePage($username, $first_name, $last_name, $idFromFbDooDaDay, $third_party_id, $gender);
echo "TRUE";
}
But then over at my Member_model I have this (I’ll edit out a bunch)
public function mCreateProfilePage($username, $first_name, $last_name, $gender, $idFromFbDooDaDay, $third_party_id)
{
// lets create a 'profile.html' used for FB object interaction
$this->load->helper('file');
ChromePhp::log('Id coming into mCreateProfilePage is ' . $idFromFbDooDaDay); // this logs as D0k9f7LxtjIHMhGnbn6UkhDk3ao WTF!?!
$data = "<html>\n";
$data .= "<head prefix=\"og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# profile: http://ogp.me/ns/profile#\">\n";
$data .= "<meta property=\"fb:app_id\" content=\"32xxxxxxxxxxxx6\" />\n"; // my APP ID
$data .= "<meta property=\"og:type\" content=\"profile\" />\n"; // stays profile
$data .= "<meta property=\"og:url\" content=\"www.MYSITE.com/profiles/id-".$idFromFbDooDaDay."\" />\n"; // put the URL
$data .= "<meta property=\"og:image\" content=\"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png\" />\n"; // url to bigPic
... edit ...
$file_path = 'profiles/id-' . $idFromFbDooDaDay . '.html';
if (!write_file($file_path, $data))
{
ChromePhp::log('Problem writing profile');
}
else
{
ChromePhp::log('Profile written to '. $file_path);
}
}
So how is that $idFromFbDooDaDay = 232 is turning into a 27-character nightmare of $idFromFbDOoDaDay = D0k9f7LxtjIHMhGnbn6UkhDk3ao over the span of a simple pass from Controller to Model?
It can’t be variable interference.. and nothing else is touching the var, as far as I can see. What is up?
Your arguments aren’t matching, that might be why 🙂