Strict standards : Non-static methods called statically

Joomla version 1.5 is end-of-life and are no longer supported. Please use Joomla 3.x instead.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
DevByStarlight
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Fri Nov 12, 2010 3:25 am

Re: Strict standards : Non-static methods called statically

Post by DevByStarlight » Mon May 23, 2011 3:03 am

And, now the temporary hack version ... using Jumi as an example.

The earlier reply message is the quick and easy way to disable the warnings via disabling the PHP.ini settings.

But we normally want those warnings and E_STRICT reports, right?

Sooooo, here's how I temporarily hacked the jumi code by disabling and restoring the message levels at runtime.

This approach works for pretty much any plugin/extension which has the problem.

~~~~

Paste the code below at the beginning of the class definitions for Jumi and Jumirouter
  • In ./jumi/jumi.php ... right after "class plgSystemJumi extends JPlugin"
  • In ./jumirouter/jumirouter.php ... right after "class plgSystemJumiRouter extends JPlugin"

Code: Select all

	////
	// Begin DevByStarlight Temporary Hack
	private $originalErrorFlags;
	private $errorHackDebug = true;
	function HideJumiErrors(){
		$this->originalErrorFlags = error_reporting();  // ini_get('error_reporting'); //--- Using INI version may not be correct if other runtime changes occur
		if ( $this->errorHackDebug == true ) {
			echo 'Quiet Jumi Before:' . $this->originalErrorFlags . "<br />\n";
		}
		error_reporting(0); // Hide messages temporarily - note: may also hide errors in any of our Jumi code too :(
	}
	function RestoreJumiErrors(){
		// Set error level back to what it was
		error_reporting($this->originalErrorFlags);
		if ( $this->errorHackDebug == true ) {
			echo 'Quiet Jumi After:' . error_reporting() . "<br /><br />\n";
		}
	}
	// End DevByStarlight Temporary Hack
	////
Then, for each Strict and Notice message, call "HideJumiErrors()" and "RestoreJumiErrors" before and after the offending line.

Example: (using the jumi.php "onAfterRender" case)

Code: Select all

      $this->HideJumiErrors();
      $mainframe = &JFactory::getApplication();
      $this->RestoreJumiErrors();
Repeat for each of the others.

There were two exceptions ...
1. parseJumiRouter (in jumirouter.php) ... the function isn't part of the class definition so

Code: Select all

	$origErrorFlags = error_reporting();
	error_reporting(0);
	$db =& JFactory::getDBO();
	error_reporting($origErrorFlags);
2. onAfterRender (in jumi.php) ... the line in question is in the "if()" logic test.

So you can either make sure RestoreJumiErrors() is called along both true or false paths. Or use the following instead.

Code: Select all

        $this->HideJumiErrors();
        $thingie = ($pluginParams->hide_code == 1);
        $this->RestoreJumiErrors();
        if ( $thingie ) {
            $content = preg_replace( $regex, '', $content );
            return true;
        }
Again, we are just hiding the errors and not really fixing anything.

Also, The HideJumiErrors and RestoreJumiErrors write out "before" and "after" values of the current flags - the numbers should be the same. Once the errors are gone and appears things are working correctly, just set ...

Code: Select all

	private $errorHackDebug = false;
... in both the jumi.php and jumirouther.php

~~~~

Sooo ... now you have the php.ini workaround or the hack code to quiet the errors locally and temporarily (using Jumi as an example).

Personally, I like the temporary "make it quiet" hack so I can keep E_STRICT enabled.

Pick whichever makes sense for you.

~~~~

Yeah, it's a pain to go through and use the temporary hide and restore hack. But actually doesn't take too long to do. And the best thing is can keep E_STRICT enabled to detect problems in your own templates, extensions, etc.!

Just remember it will re-appear when you install an update of the plugin (unless the developer fixes it of course). And it'll occur when installing new extensions too ... but that's quick and easy copy pastey.

P.S - I went back to look through my Joomla 1.5.x sites in development mode with the new PHP with E_STRICT enabled and (Sweet maple syrup, Batman!) there were tons of these messages.

User avatar
Kev261266
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Thu May 20, 2010 7:33 am
Location: South Shields, UK

Re: Strict standards : Non-static methods called statically

Post by Kev261266 » Mon May 23, 2011 4:53 am

Hi wdemilly,

As I previously posted, do the following:

Go to the file:

D:\XAMPP\PHP\php.ini
In my install this was on line 109

change
error_reporting = E_ALL | E_STRICT
to
error_reporting = E_ALL & ~E_NOTICE

Next go to

D:\XAMPP\HTDOCS\"yourjoomlainstallname"\configuration.php
(line 20 in my installation)

Change the $error_reporting value to 6135

If you have not already turned XAMPP off then turn it off (fully off) turn it back on and the error notices will no longer appear.

Condensed or what?

Kev.
Cheers.

Kev.
----

bulletcow
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Jun 05, 2011 2:15 am

Re: Strict standards : Non-static methods called statically

Post by bulletcow » Sun Jun 05, 2011 2:17 am

Thanks Kev, for taking the time to make that process easy for me =)

User avatar
Kev261266
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Thu May 20, 2010 7:33 am
Location: South Shields, UK

Re: Strict standards : Non-static methods called statically

Post by Kev261266 » Wed Jun 08, 2011 5:21 am

bulletcow wrote:Thanks Kev, for taking the time to make that process easy for me =)
You're very welcome. ;)
dontak wrote:hi Kev261266
i use appserv what i must do??
Hi dontak, Appserv seems to be a cut down version of xampp. So the procedure should be the same? (they both have php, which are the files you need to edit) Though I have no experience of appserv, so should not really advise on it.

Sorry :-[
Cheers.

Kev.
----

User avatar
wyocrook
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Jun 07, 2011 6:08 pm

Re: Strict standards : Non-static methods called statically

Post by wyocrook » Wed Jun 08, 2011 8:43 pm

Hey Folks

Windows 7
easyphp5.3.6
apache 2.2.19
php 5.3.6

I am installing Joomla on my local host so that I can edit css templates. I have been following this thread, and it has been useful.

I followed the tip to change $error_reporting = (6135); That took the number of errors down from what seemed like 1000 to just 30, but there are still 30 errors left. Below the errors, however, the page displays correctly. But I would like to get rid of all the errors. I would also like to understand why changing the values for error_reporting in the php.ini does not seem to be doing anything.

Joomla > configuration.php
Program Files > Easyphp > php.ini

These are the two files I have manipulated.

So I am almost there. Might anyone know why I still get errors, and why my changes to php.ini don't seem to matter? I have restarted apache everytime.

I must use joomla! 1.5 because 1.6 is not compatible with VirtueMart, and the whole point of my doing this is so that I can set up an online shopping cart through joomla.

Any feedback would be awesome.

Thanks

Lee
Would you rather be well-known, or known well?

User avatar
Kev261266
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Thu May 20, 2010 7:33 am
Location: South Shields, UK

Re: Strict standards : Non-static methods called statically

Post by Kev261266 » Thu Jun 09, 2011 1:53 pm

Hi Lee,

I'm just speculating here, but maybe easyphp which you are using is responding differently to the php bundled with xampp.
Joomla > configuration.php
Program Files > Easyphp > php.ini
If I was having too much trouble (which you seem to be having) with the strict standards, I would just install the older version of xampp. I used this with J1.5 and never seemed to have any of the problems that show up in the new version.

Hope this helps.

Kev.
Cheers.

Kev.
----

User avatar
wyocrook
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Jun 07, 2011 6:08 pm

Re: Strict standards : Non-static methods called statically

Post by wyocrook » Thu Jun 09, 2011 4:51 pm

I might give that a try. I am very new to php, but I think it would be good for me to branch and learn the strengths of the different server programs.

Thanks
Lee
Would you rather be well-known, or known well?

User avatar
Kev261266
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Thu May 20, 2010 7:33 am
Location: South Shields, UK

Re: Strict standards : Non-static methods called statically

Post by Kev261266 » Mon Jun 13, 2011 9:39 am

kingdomvision1 - That is the most scumbag way of advertising a site I have ever seen.

This forum is to help people, not for you to promote your crappy site.

People like you are a true disgrace.

:-[ Looks like a moderator already removed the post I was referring to.
Cheers.

Kev.
----

User avatar
Saushine
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Jul 07, 2011 11:18 am

Re: Strict standards : Non-static methods called statically

Post by Saushine » Thu Jul 07, 2011 11:26 am

Kev261266 wrote:Hi wdemilly,

As I previously posted, do the following:

Go to the file:

D:\XAMPP\PHP\php.ini
In my install this was on line 109

change
error_reporting = E_ALL | E_STRICT
to
error_reporting = E_ALL & ~E_NOTICE

Next go to

D:\XAMPP\HTDOCS\"yourjoomlainstallname"\configuration.php
(line 20 in my installation)

Change the $error_reporting value to 6135

If you have not already turned XAMPP off then turn it off (fully off) turn it back on and the error notices will no longer appear.

Condensed or what?

Kev.
IT WORKS! thanks a bunch Kev!!
if you guys have changed all the php lines, restart XAMPP, and still see no improvement, RESTART YOUR COMPUTER. Works for me :)

User avatar
Kev261266
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 177
Joined: Thu May 20, 2010 7:33 am
Location: South Shields, UK

Re: Strict standards : Non-static methods called statically

Post by Kev261266 » Fri Jul 08, 2011 12:57 pm

Glad you got it sorted eventually. ;-)
Cheers.

Kev.
----

User avatar
Jadu
Joomla! Intern
Joomla! Intern
Posts: 63
Joined: Thu Jul 07, 2011 1:15 pm

Re: Strict standards : Non-static methods called statically

Post by Jadu » Sat Jul 09, 2011 11:49 pm

I've changed the above value "var $error_reporting = ’6135′;" But nothing happens,,

metiko
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon May 30, 2011 8:48 pm

Re: Strict standards : Non-static methods called statically

Post by metiko » Sun Jul 17, 2011 6:56 pm

I use xampp 1.7.4 have change the value as Kev261266 said but it worl half of them..

Image

I think I shoul try older version of xampp.

User avatar
FreeThinker
Joomla! Intern
Joomla! Intern
Posts: 95
Joined: Fri Mar 06, 2009 2:22 pm
Location: Madeira island - Portugal
Contact:

Re: Strict standards : Non-static methods called statically

Post by FreeThinker » Tue Jul 19, 2011 7:40 pm

wonderful stuff....

....simply open your php.ini

=> change the lines
(516) error_reporting = E_ALL & ~E_NOTICE
(533) display_errors = Off

*restart your Xampp / Wampp / Lampp ...etc.... and refresh browsers site 8)

metiko
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon May 30, 2011 8:48 pm

Re: Strict standards : Non-static methods called statically

Post by metiko » Wed Jul 20, 2011 3:07 pm

^^^ Resloved!!Thank you very much FreeThinker XD

erinvarejes
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Jul 21, 2011 9:25 am

Re: Strict standards : Non-static methods called statically

Post by erinvarejes » Thu Jul 21, 2011 12:23 pm

hy, i found the php.ini file and changed the settings for error reporting however it will not let me save the file, it tells me it cannot creat the C://users.......
and i have to make sure the path and file name is correct any ideas?

dmwell
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Thu Jul 14, 2011 7:06 am
Location: Berlin, Germany
Contact:

Re: Strict standards : Non-static methods called statically

Post by dmwell » Thu Jul 21, 2011 12:46 pm

Saushine wrote:
Kev261266 wrote:Hi wdemilly,

As I previously posted, do the following:

Go to the file:

D:\XAMPP\PHP\php.ini
In my install this was on line 109

change
error_reporting = E_ALL | E_STRICT
to
error_reporting = E_ALL & ~E_NOTICE

Next go to

D:\XAMPP\HTDOCS\"yourjoomlainstallname"\configuration.php
(line 20 in my installation)

Change the $error_reporting value to 6135

If you have not already turned XAMPP off then turn it off (fully off) turn it back on and the error notices will no longer appear.

Condensed or what?

Kev.
IT WORKS! thanks a bunch Kev!!
if you guys have changed all the php lines, restart XAMPP, and still see no improvement, RESTART YOUR COMPUTER. Works for me :)
Brilliant - all working and good to go!!
Man walks into a bar... ouch!

anshekerman
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Jul 31, 2011 2:14 pm

Re: Strict standards : Non-static methods called statically

Post by anshekerman » Sun Jul 31, 2011 2:20 pm

I had these same problem.
Was solved bij changing the configuration.php
* EARLIER VALUE : var $error_reporting = ‘-1′;
* CHANGED VALUE: var $error_reporting = ’6135′;



thanks a lot for this advice, nothing else was needed! ;)

Fletcher12
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Feb 20, 2011 12:29 pm

Re: Strict standards : Non-static methods called statically

Post by Fletcher12 » Tue Aug 02, 2011 10:35 am

You saved me from trouble! Thanks! :)
judy2segev wrote:Once I was trying to remove these following errors after installing Joomla-
Strict Standards: Non-static method JLoader::import() should not be called statically in /opt/lampp/htdocs/joomla/libraries/joomla/import.php on line 29

Strict Standards: Non-static method JLoader::register() should not be called statically in /opt/lampp/htdocs/joomla/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /opt/lampp/htdocs/joomla/libraries/joomla/import.php on line 32

Strict Standards: Non-static method JLoader::register() should not be called statically in /opt/lampp/htdocs/joomla/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::load() should not be called statically in /opt/lampp/htdocs/joomla/libraries/loader.php on line 161

Strict Standards: Non-static method JLoader::register() should not be called statically in /opt/lampp/htdocs/joomla/libraries/loader.php on line 138

Strict Standards: Non-static method JRequest::clean() should not be called statically in /opt/lampp/htdocs/joomla/libraries/joomla/import.php on line 33
I was able to repair it by changing the following value in configuration.php file which is present in Joomla home folder.
* EARLIER VALUE : var $error_reporting = ‘-1′;
* CHANGED VALUE: var $error_reporting = ’6135′;
May be this can help somebody facing related problem.
Political message removed. Please, see forum rules.

John Taggart
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Tue Aug 02, 2011 2:40 pm

Re: Strict standards : Non-static methods called statically

Post by John Taggart » Tue Aug 02, 2011 3:44 pm

Kev261266 wrote:Hi wdemilly,

As I previously posted, do the following:

Go to the file:

D:\XAMPP\PHP\php.ini
In my install this was on line 109

change
error_reporting = E_ALL | E_STRICT
to
error_reporting = E_ALL & ~E_NOTICE

Next go to

D:\XAMPP\HTDOCS\"yourjoomlainstallname"\configuration.php
(line 20 in my installation)

Change the $error_reporting value to 6135

If you have not already turned XAMPP off then turn it off (fully off) turn it back on and the error notices will no longer appear.

Condensed or what?

Kev.
Thanks Kev...that fix worked for me on XAMPP v1.7.4...now if I can just figure out all this template confusion. :-[

mickawallace
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Jul 22, 2011 10:17 pm

Re: Strict standards : Non-static methods called statically

Post by mickawallace » Wed Aug 17, 2011 4:51 pm

Where do I find php.ini?

anshekerman
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Jul 31, 2011 2:14 pm

Re: Strict standards : Non-static methods called statically

Post by anshekerman » Wed Aug 17, 2011 8:21 pm

D:\XAMPP\PHP\php.ini

kmor10sen
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Aug 17, 2011 8:29 pm

Re: Strict standards : Non-static methods called statically

Post by kmor10sen » Wed Aug 17, 2011 8:31 pm

judy2segev
Post subject: Re: Strict standards : Non-static methods called staticallyPosted: Thu Sep 16, 2010 12:38 pm
Joomla! Fledgling

Quote:
* EARLIER VALUE : var $error_reporting = ‘-1′;
* CHANGED VALUE: var $error_reporting = ’6135′;


May be this can help somebody facing related problem.
This was the first thing I tried and it worked for me.

Thanks!

mickawallace
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Jul 22, 2011 10:17 pm

Re: Strict standards : Non-static methods called statically

Post by mickawallace » Wed Aug 17, 2011 9:38 pm

anshekerman wrote:D:\XAMPP\PHP\php.ini
Doesn't seem to be there.

kmor10sen
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Aug 17, 2011 8:29 pm

Re: Strict standards : Non-static methods called statically

Post by kmor10sen » Wed Aug 17, 2011 9:42 pm

Check the configuration.php

mickawallace
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Jul 22, 2011 10:17 pm

Re: Strict standards : Non-static methods called statically

Post by mickawallace » Wed Aug 17, 2011 9:46 pm

mickawallace wrote:
anshekerman wrote:D:\XAMPP\PHP\php.ini
Doesn't seem to be there.
Think I found it - this is what it says:

; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED


What changes do I make here?

anshekerman
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Jul 31, 2011 2:14 pm

Re: Strict standards : Non-static methods called statically

Post by anshekerman » Wed Aug 17, 2011 10:13 pm

go to

D:\XAMPP\HTDOCS\"yourjoomlainstallname"\configuration.php

Change the $error_reporting value from -1 to 6135

If you have not already turned XAMPP off then turn it off (fully off) turn it back on and the error notices will no longer appear.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44070
Joined: Sat Apr 05, 2008 9:58 pm

Re: Strict standards : Non-static methods called statically

Post by Webdongle » Wed Aug 17, 2011 10:21 pm

No need to edit the configuration.php file !!!

In the php.ini file
locate
error_reporting =
And change the value to
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
locate
display_errors = On
And change the value to
display_errors = Off
Stop then restart xampp for the new settings to take effect
(N.B. there are comments about error_reporting = as well as the command line.)

The pic shows how to find the file php.ini, yours will be different but it should help you
Screenshot-571.png
You do not have the required permissions to view the files attached to this post.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

mickawallace
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Jul 22, 2011 10:17 pm

Re: Strict standards : Non-static methods called statically

Post by mickawallace » Thu Aug 18, 2011 12:04 am

Webdongle wrote:No need to edit the configuration.php file !!!

In the php.ini file
locate
error_reporting =
And change the value to
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
locate
display_errors = On
And change the value to
display_errors = Off
Stop then restart xampp for the new settings to take effect
(N.B. there are comments about error_reporting = as well as the command line.)

The pic shows how to find the file php.ini, yours will be different but it should help you
Screenshot-571.png
Thanks, that worked like a charm, go raibh maith agat mo chara!!!

olyver
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Sep 01, 2011 10:25 pm

Re: Strict standards : Non-static methods called statically

Post by olyver » Thu Sep 01, 2011 10:33 pm

i had exacly the same problem, got kind of desperate and ended up removing all the E_STRICT from all the php.ini files...
i did what judy2segev said as well, and now appears the administration login box, but above it still some Strict Standard lines and also these ones:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\joomla15\libraries\joomla\import.php:46) in C:\xampp\htdocs\joomla15\libraries\joomla\session\session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\joomla15\libraries\joomla\import.php:46) in C:\xampp\htdocs\joomla15\libraries\joomla\session\session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\joomla15\libraries\joomla\import.php:46) in C:\xampp\htdocs\joomla15\libraries\joomla\session\session.php on line 426

any advice, please??

I don't know what to do...

thanks in advance!!

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44070
Joined: Sat Apr 05, 2008 9:58 pm

Re: Strict standards : Non-static methods called statically

Post by Webdongle » Fri Sep 02, 2011 3:17 am

olyver wrote:....
any advice, please??

I don't know what to do...
..
Re read the solution that is given on this thread (several times).
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".


Locked

Return to “Installation 1.5”