Here's my case :
I'm using SugarCRM's API, and to make a call, I had to patch some functions to make things work. In one of the function, I had to rewrite this code :
$credentials = array('user_name'=>"xxxxxxx", 'password'=>md5("xxxxx"));
if (SugarWebServiceImpl::login($credentials, null, null)) {
global $current_user;
require_once('modules/Users/User.php');
$current_user = new User();
$current_user->retrieve($_SESSION['user_id']);
$this->login_success();
return true;
}
My problem is that on the same call, my variable $_REQUEST
becomes empty. My question is simple then :
is there any relation between the $_SESSION
variable and the $_REQUEST
variable. Does the $_REQUEST
empties herself when a new $_SESSION
is set ?
No, There is not. According to PHP Manual
$_REQUEST
is An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.
However that just answers your question but doesn't solve the problem. If that issue happens here
$current_user->retrieve($_SESSION['user_id']);
then it would help to be able to see that retrieve method
No, $_SESSION
and $_REQUEST
have no relation whatsoever.
$_SESSION
and $_REQUEST
are unrelated.
$_SESSION
- variables stored in the session scope (per user), e.g. available until PHPSESSID
cookie is set by session_start()
and remains set in the user browser.
$_REQUEST
- parameters provider for the current request, either query parameters (also accessible via $_GET
, post/form fields (also accessible via $_POST
or cookies (also accessible via $_COOKIES
).