login failure: headers have already been sent Topic is solved

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
82bredel
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Nov 08, 2020 6:30 pm

login failure: headers have already been sent

Post by 82bredel » Sun Nov 08, 2020 6:35 pm

I can't login.
I get this report:

0 Failed to start the session because headers have already been sent by "/customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php" at line 126.



A the top i can read: Deprecated: Function get_magic_quotes_gpc() is deprecated in /customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php on line 126


What should i do?

82bredel
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Nov 08, 2020 6:30 pm

Re: login failure: headers have already been sent

Post by 82bredel » Sun Nov 08, 2020 7:15 pm

Problem solved!

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13570
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: login failure: headers have already been sent

Post by toivo » Sun Nov 08, 2020 8:40 pm

Thanks for marking the topic as solved. However, for the benefit of others having a similar problem, how did you fix the issue, please?
Toivo Talikka, Global Moderator

noideajase
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Nov 26, 2011 4:14 am

Re: login failure: headers have already been sent

Post by noideajase » Thu Jun 17, 2021 4:38 am

I am having the same issue with my Joomla Administrator login (front end is ok).
If anyone can share the solution it would be greatly appreciated.
Cheers
Jase

noideajase
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Nov 26, 2011 4:14 am

Re: login failure: headers have already been sent

Post by noideajase » Thu Jun 17, 2021 4:55 am

.... Quick update, I also fixed this, in my acase it was AdministratorApplication.php located at
*yourWebSite Here*/public_html/libraries/src/Application/AdministratorApplication.php
Line 126 runs a quick test to check if magic quotes are on and if so throws the following error message
"Your host needs to disable magic_quotes_gpc to run this version of Joomla!"
I have commented out lines 124 to 139 and this has fixed the issue,logically speaking I can see this will not cause a problem as it tests for the existence of a now deprecated function then if it were running would throw an errror message, so if you can navigate your way to the code block that runs this test than it is safe to comment out.
If you have never commented php out before you are looking to replicate the below bit of code (note that */ will comment out every line until */ otherwise // comments out only single lines of code):

line 124 /*
// Test for magic quotes
if (get_magic_quotes_gpc())
{
$lang = $this->getLanguage();

if ($lang->hasKey('JERROR_MAGIC_QUOTES'))
{
$this->enqueueMessage(\JText::_('JERROR_MAGIC_QUOTES'), 'error');
}
else
{
$this->enqueueMessage('Your host needs to disable magic_quotes_gpc to run this
version of Joomla!', 'error');
}
}
line 139 */

StevenDs
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jun 22, 2021 4:54 pm

Re: login failure: headers have already been sent

Post by StevenDs » Tue Jun 22, 2021 5:06 pm

82bredel wrote:
Sun Nov 08, 2020 6:35 pm
I can't login.
I get this report:

0 Failed to start the session because headers have already been sent by "/customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php" at line 126.



A the top i can read: Deprecated: Function get_magic_quotes_gpc() is deprecated in /customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php on line 126


What should i do?

You can either check the password that you have entered during login since its case sensitive or you can wait for sometime and reload the page with the correct login details.

noideajase
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Nov 26, 2011 4:14 am

Re: login failure: headers have already been sent

Post by noideajase » Tue Jun 22, 2021 9:53 pm

StevenDs wrote:
Tue Jun 22, 2021 5:06 pm
82bredel wrote:
Sun Nov 08, 2020 6:35 pm
I can't login.
I get this report:

0 Failed to start the session because headers have already been sent by "/customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php" at line 126.



A the top i can read: Deprecated: Function get_magic_quotes_gpc() is deprecated in /customers/f/d/3/gvbdeboomgaard.be/httpd.www/libraries/src/Application/AdministratorApplication.php on line 126


What should i do?

You can either check the password that you have entered during login since its case sensitive or you can wait for sometime and reload the page with the correct login details.
@StevenDs the issue has noting to do with the logon form, it is a result of a piece of code running a test against a deprecated PHP function, teh code looks for the existence than prompts to turn off however since this function no longer exists it results in an error.

My post above provides a solution (comment out the lines), which is a code edit.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13570
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: login failure: headers have already been sent

Post by toivo » Wed Jun 23, 2021 9:24 am

This is actually a known problem that affected versions of Joomla before 3.9.13 and was fixed in October 2019 by the pull request [#26615] - Suppress get_magic_quotes_gpc() deprecation notices.

The current lines 125-138 of the file libraries/src/Application/AdministratorApplication.php in Joomla 3.9.27 test the function get_magic_quotes_gpc() only in PHP versions before 5.4, which eliminates the deprecated message in later versions of PHP:

Code: Select all

		// Test for magic quotes
		if (PHP_VERSION_ID < 50400 && get_magic_quotes_gpc())
		{
			$lang = $this->getLanguage();

			if ($lang->hasKey('JERROR_MAGIC_QUOTES'))
			{
				$this->enqueueMessage(\JText::_('JERROR_MAGIC_QUOTES'), 'error');
			}
			else
			{
				$this->enqueueMessage('Your host needs to disable magic_quotes_gpc to run this version of Joomla!', 'error');
			}
		}
Toivo Talikka, Global Moderator

noideajase
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Nov 26, 2011 4:14 am

Re: login failure: headers have already been sent

Post by noideajase » Wed Jun 23, 2021 11:14 am

Thanks for this update - I am running PHP 7.4.2 on my site and hadn't logged into teh back end in over 6 months.
I have now pushed all the Joomla! updates as it appeared stuck.
Would the updates have over written the AdministratorApplication.php script?—Just curious, nothing else.

Cheers
Jase
toivo wrote:
Wed Jun 23, 2021 9:24 am
This is actually a known problem that affected versions of Joomla before 3.9.13 and was fixed in October 2019 by the pull request [#26615] - Suppress get_magic_quotes_gpc() deprecation notices.

The current lines 125-138 of the file libraries/src/Application/AdministratorApplication.php in Joomla 3.9.27 test the function get_magic_quotes_gpc() only in PHP versions before 5.4, which eliminates the deprecated message in later versions of PHP:

Code: Select all

		// Test for magic quotes
		if (PHP_VERSION_ID < 50400 && get_magic_quotes_gpc())
		{
			$lang = $this->getLanguage();

			if ($lang->hasKey('JERROR_MAGIC_QUOTES'))
			{
				$this->enqueueMessage(\JText::_('JERROR_MAGIC_QUOTES'), 'error');
			}
			else
			{
				$this->enqueueMessage('Your host needs to disable magic_quotes_gpc to run this version of Joomla!', 'error');
			}
		}
[/quote]

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13570
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: login failure: headers have already been sent

Post by toivo » Wed Jun 23, 2021 1:53 pm

noideajase wrote:
Wed Jun 23, 2021 11:14 am
I have now pushed all the Joomla! updates as it appeared stuck.
It is not clear what you mean. What does the update log look like in administrator/logs/joomla_update.php?

Joomla 3.9 is updated from Components - Joomla! Update.

noideajase wrote:
Wed Jun 23, 2021 11:14 am
Would the updates have over written the AdministratorApplication.php script?
Depending on the update file chosen, a successful update to 3.9.27 should have replaced the file AdministratorApplication.php.

Questions: which was the earlier version of Joomla? Which update file did you use?
Toivo Talikka, Global Moderator


Post Reply

Return to “General Questions/New to Joomla! 3.x”