After upgrading to Xampp 1.8.1, can't view my sites - joomla

I was using xampp 1.7.0 but just decided to upgrade to xampp 1.8.1. I uninstalled the 1.7 but didn't uninstall the htdocs and mysql server.
I now installed 1.8 and create passwords for the xampp directory and mysql through the xampp security page.
Unfortunately, I can't view my sites again, they all give errors, this is a sample error:
Strict Standards: Non-static method JLoader::import() should not be called statically in C:\xampp\htdocs\3nity\libraries\joomla\import.php on line 29
Strict Standards: Non-static method JLoader::register() should not be called statically in C:\xampp\htdocs\3nity\libraries\loader.php on line 71
Strict Standards: Non-static method JLoader::import() should not be called statically in C:\xampp\htdocs\3nity\libraries\joomla\import.php on line 32
Strict Standards: Non-static method JLoader::register() should not be called statically in C:\xampp\htdocs\3nity\libraries\loader.php on line 71
Strict Standards: Non-static method JLoader::register() should not be called statically in C:\xampp\htdocs\3nity\libraries\loader.php on line 138
Strict Standards: Non-static method JRequest::clean() should not be called statically in C:\xampp\htdocs\3nity\libraries\joomla\import.php on line 33
Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in C:\xampp\htdocs\3nity\libraries\joomla\environment\request.php on line 463
Please what can I do because i don't have a backup of all the sites, 5 years of hard work with a current clients project at hand now.
I use a win 7 operating system 64bit, used xampp-win32-1.8.1-VC9-installer.

This is likely due to a different (newer) version of PHP in the latest XAMPP. PHP 5.4 (PHP 5.4.7 to be exact) is more strict about warning for bad code.
The real problem is in the actual PHP code (either yours or code used in a package use use, like Joomla).
If it is coming from your code, you should fix it. Do so by accessing a static method property or property in a static way (e.g. class Foo { public static $bar = 123; } and Foo::$bar to access it, and class Bar { public static function foo() { } } and Bar::foo() to invoke it. Note how we use :: instead of ->. This means there is no active instantiation state (In other words, $bar = new Bar(); $bar->foo(); is incorrect as it calls it as a instance method instead of statically through Bar::foo()).
And likewise if the problem is the other way around, the developer may have to declare a method as static if it is stateless and called statically.
For the Joomla case it seems there are various reports about it already:
http://forum.joomla.org/viewtopic.php?t=271244
http://www.apachefriends.org/f/viewtopic.php?p=182516
http://www.apachefriends.org/f/viewtopic.php?p=166802
(Found by just pasting the error in Google!)
Learn more about the difference between state and static:
http://php.net/manual/en/language.oop5.static.php
http://phpduck.com/php-static-methods-and-properties/
If you only have warnings (not errors), look into "php error_reporting" to find out how to disable these innocent warnings (by lowering the error reporting level). That way you reduce the noise and can focus on things that matter.
During development you should probably not hide any warnings and so that you can spot them and improve your code. But in production it may be better to hide the warnings and only log errors.

After going through all the information and links presented, I was able to overcome the strict standard issue. The changes I made earlier didn't reflect because I was changing the values at the wrong line.
This is what I did:
I had to edit line 535 & 552 of my php.ini file and set display errors to OFF and also used this setting: error_reporting = E_ALL & ~E_NOTICE.
Both Joomla 1.5 and 2.5 sites don't give errors again.
Thanks to everybody.

Related

Why does a "on a non-object" error occurs with this extension in Magento?

I'm having an Issue with a blog extension in Magento CE 1.6.2.0.
I installed this extension: Neotheme_nBlog.
I created an entry in the administrator.
Then I went to http://www.example.com/index.php/blog/ to see the recently created entry.
What I saw was an error like this:
Fatal error: Call to a member function getName() on a non-object
in /home/example.com/public_html/app/design/frontend/default/caramel/template/magicat/left.phtml
I searched in google the terms: "template/magicat/left.phtml" getName and what I only found is sites having this issue, but no support at all.
Please note: I know what does that error mean in PHP ("unfortunately" I'm not new at that). What I don't understand is what's happening with such [NON/null] object and how to fix it without killing a dozen of kittens.
Question: What can I do to solve it? What is the nature of the error, regarding Magento?(again: not PHP).
Notes: The Magento site (http://magento.stackexchange.com) is somewhat poor and strict to bring support of such nature, so asking there is not an option.
Edit (as answer to comment, and to clarify):
Neotheme is still not responding the request.
Don't know what should I look on such file (instances are not initialized there, but only accessed).
I'm using the default theme (caramel), which has esthetical changes (does not have layout changes).
It's hard to say without seeing your system specifically, but on this
template/magicat/left.phtml
It looks like you've added a template named magicat/left.phtml to your system -- either via an extension or custom development. Somewhere in this file PHP's called getName on a non-object. There's a variety of reasons this could be happening, and without seeing the specific line of code PHP's complaining about in your system, it's hard to say. It'd also be helpful to know if magicat is part of the extension or something else.
The most common reason for this error in a template is code that relies on a block being there that's been removed by another extension (eitehr via layout XML or observer methods)
$this->getLayout()->getBlock('some_block')->getName();
The next most common is people using the registry to communicate between templates and views, but a registry key not being set
Mage::registry('some_item')->getName();
Without knowing the variable and context, it's doubtful anyone will be able to help you.

npp_destroy gets called immediately after npp_new

I am trying to make a NPAPI plugin for chrome on Mac. I have written a basic npapi plugin and a basic manifest.json and background.html to load it. My background.html has a embed tag to fetch the plugin by Mimetype.
Now when I load my unpackaged extension from Chrome and try to debug the c++ code (in xcode4), I found that the functions are getting called in following order:
NP_Initialize
NP_GetEntryPoints
NPP_New
NPP_Destroy
After this when I click on the extension icon, the popup.html should get executed. My popup.html has these lines:
line 1:
var pluginObj = document.getElementById("pluginId");
line 2:
pluginObj.Myfunction();
But on line 1, NP_Getvalue() function doesnt get called and so a "scriptable NPObject" is not instantiated. On line 2, the Chrome JavaScript console says:
Error in event handler for 'undefined': Object #<HTMLEmbedElement> has no method 'Myfunction' TypeError: Object #<HTMLEmbedElement> has no method 'Myfunction'
Why does the NPP_Destroy functions gets called immediately after the NPP_New function?
Have you done drawing and event model negotiation in your plugin? Starting with Chrome 22 for Mac, the long-deprecated QuickDraw and Carbon models are no longer supported, and if your plugin doesn't negotiate modern models, it will be destroyed just after init. See here for example code that does this.
(Yes, it's unfortunate that the default models for 32-bit plugins are the old, deprecated models, but there's no way to change that in the spec due to all the existing plugins that expect the old behavior.)

CakePhp2 defined CAKE_CORE_INCLUDE_PATH, now DS and CORE_PATH undefined in ShellDispatcher

In order to share CakePhp2 core between many sites I edited CAKE_CORE_INCLUDE_PATH in webroot/index.php to point to the cake directory. That works and I can reach my welcome page.
However, when I attempted to run the Cake Console, I ran into issues with ShellDispatcher.php not defining DS and CORE_PATH because they were only defined if CAKE_CORE_INCLUDE_PATH was NOT defined. Once I defined them out of the if statement which checks if CAKE_CORE_INCLUDE_PATH was not defined, I was good to go. However, I would prefer not to "hack" this file because I want to keep the cake core files clean. Are there any better and cleaner options?
I also had to defined CAKE_CORE_INCLUDE_PATH and use it to set $dispatcher in Console/cake.php which is part of the app of course.
Yes there are. As a start never define application-wide variables in Webroot/index.php. As a matter of fact you shouldn't be touching this file at all. You can define variables in
Config/bootstrap.php.
You were getting the error because when in a Shell you're not firing Webroot/index.php at all - you're actually running PHP's CLI and CakePHP fires off in a different manner.
It will go through the bootstrap.php file of course.
You should also use this file to define any global vars, but there is a little bottleneck
here when using PHP's $_SERVER variable's web server related members - e.g. HTTP_HOST and the definition: $myHost = $_SERVER['HTTP_HOST'];. If you start a shell Cake will try to set this variable and it will fail throwing an error. This is because as mentioned before PHP will be running in CLI mode when the CakeShell is envoked. There is a way to detect this of course - you can use $_SERVER['SCRIPT_FILENAME'] or $_SERVER['SCRIPT_NAME'] in bootstrap.php to identify if you're in CLI or not. :)

Cakephp Revision behavior hurdles validation error?

I have a CakePHP ticketing app where I am using Revision Behavior to keep revision history of each tickets. The problem I have using this behavior is, it does not display validation error messages. Here is the line I have added in the model.
public $actsAs = array('Revision' => array('limit'=>10));
When I comment this line, it displays error messages and otherwise it does not. Also, when I debug it using x-debug, I see validationErrors variable is set and has all error message values set properly.
Please shed some light here.
Edit: I am using Cake 2.1
First, be sure to get the last version of this behavior : http://alkemann.googlecode.com/svn/trunk/models/behaviors/revision.php
for integration in CAKE 2.X, the problem comes from line 980 in the createShadowModel() function:
$Model->ShadowModel->alias = $Model->alias;
The behavior gives the same alias to the base model and its shadowmodel it will save in the _revs table and that seems to mess up the validation messages.
The problem is that this behavior is loaded automatically when you access your model, and the createShadowModel() function is called even if your input doesn't validate.
One of the solution would be to comment out this line from createShadowModel() and then to add it only to every function in the behavior that will make an operation in the DB . There is surely a better way than that, like detecting in the setup() if there is need to go further to initialization, but couldn't find how to do it. So that's my first step towards at least allowing to use this behavior in Cake 2.X.
There are a few things that could be happening here. Too much for one to simply tell you what is happening since we don't have any of your code. However, I am pretty certain that this behavior, being that it was written in 2008, will have issues with CakePHP version 2.1, which just released its first alpha. There have been a lot of changes to the infrastructure of Cake that could cause this not to work. I'd say this would probably work with version 1.3 and definitely with 1.2, but getting support for 2.1 probably won't happen without updates.
That said, this is a behavior, which should only alter model code. So, there should be not impact (theoretically) on your view. Are you sure you are using the proper conventions in your code to display errors (even though commenting it out changes displayed messages).
I'd look for a 2.0+ compatible version of the behavior. Or, you could throw the code on Github and start to port it yourself. You may get some help from some Cake people.

Is there any good sample about facebook-php-sdk3.0+ with CodeIgniter2.0+?

I use CodeIgniter2.0.3 and facebook-php-sdk3.1.1 to develop an application.
When I run the project,is says:
Fatal error: Cannot redeclare class Facebook in ../application/libraries/facebook.php on line 24
The source of line 24 is:
class Facebook extends BaseFacebook
What's the reason?How to deal with it?
Check the name of your controller. If it is called Facebook then that is your problem, you cannot have 2 classes called the same thing at once, unless they are in different namespaces.
I wouldn't suggest using the normal Facebook PHP-SDK when there are a number available over on codeigniter sparks that perform most of the same functions but already setup to work with codeigniter without these conflicts.

Resources