User tests: Successful: Unsuccessful:
Added additional check for output buffer state before proceeding to dynamically modify session settings via. ini_set since the function headers_sent()
is proving inadequate for the 'headers already sent check'.
If the above check is skipped the application throws the following warning
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in /var/www/html/xxxx/libraries/joomla/session/storage/redis.php on line 58
Try programatically registering a user and then logging them in into the system.
jimport('joomla.user.helper');
$user = new JUser;
if (!$user->guest) {
jexit();
}
//Write to database
if (!$user->bind($data)) {
jexit();
}
if (!$user->save()) {
jexit();
}
$user_id = $user->id;
if (!isset($user->id) || empty($user->id)) {
jexit();
}
$options = array();
$credentials = array();
$credentials['username'] = $email;
$credentials['password'] = $tempUser['password'];
echo "before logging in";
// this line will throw the aforementioned error.
$result = JFactory::getApplication()->login($credentials, $options);
The system should not throw the warning since a "headers sent check" is already put in place.
Since output buffering though discouraged, still is allowed in joomla the user has a possibility of having it on, and 'headers_sent()' doesn't register the headers sent to output buffer.
as explained here
http://www.plus2net.com/php_tutorial/headers_sent.php
None
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-09 12:03:25 |
Closed_By | ⇒ | cguroo |
Status | Closed | ⇒ | New |
Closed_Date | 2018-04-09 12:03:25 | ⇒ | |
Closed_By | cguroo | ⇒ |
Status | New | ⇒ | Pending |
Labels |
Added:
?
Removed: ? |
Sorry that it took so long to respond. Can you update the description of this pr in which context your issue occurs? At the moment this looks like a special situation. As Joomla has evolved there might be other ways to implement your use case. In the meantime I'm closing the pr, when updated, please reopen again or make one for Joomla 4. Thanks for your help making Joomla better.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-04-08 07:37:50 |
Closed_By | ⇒ | laoneo |
Need more testing, shall reopen with full solution.