? Failure

User tests: Successful: Unsuccessful:

avatar cyberguroo
cyberguroo
7 Apr 2018

Summary of Changes

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

Testing Instructions

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);

Expected result

The system should not throw the warning since a "headers sent check" is already put in place.

Actual result

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

Documentation Changes Required

None

avatar cguroo cguroo - open - 7 Apr 2018
avatar cguroo cguroo - change - 7 Apr 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2018
Category Libraries
avatar cguroo cguroo - change - 7 Apr 2018
The description was changed
avatar cguroo cguroo - edited - 7 Apr 2018
avatar cguroo cguroo - change - 7 Apr 2018
Labels Added: ?
avatar cguroo cguroo - change - 9 Apr 2018
The description was changed
avatar cguroo cguroo - edited - 9 Apr 2018
avatar cyberguroo
cyberguroo - comment - 9 Apr 2018

Need more testing, shall reopen with full solution.

avatar cguroo cguroo - change - 9 Apr 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-04-09 12:03:25
Closed_By cguroo
avatar cguroo cguroo - close - 9 Apr 2018
avatar cyberguroo cyberguroo - close - 9 Apr 2018
avatar cguroo cguroo - change - 10 Apr 2018
Status Closed New
Closed_Date 2018-04-09 12:03:25
Closed_By cguroo
avatar cguroo cguroo - change - 10 Apr 2018
Status New Pending
avatar cguroo cguroo - reopen - 10 Apr 2018
avatar cyberguroo cyberguroo - reopen - 10 Apr 2018
avatar laoneo laoneo - change - 29 Mar 2022
Labels Added: ?
Removed: ?
avatar laoneo
laoneo - comment - 8 Apr 2022

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.

avatar laoneo laoneo - change - 8 Apr 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-04-08 07:37:50
Closed_By laoneo
avatar laoneo laoneo - close - 8 Apr 2022

Add a Comment

Login with GitHub to post a comment