I have recently moved a website from one host to another and all went smoothly except one plugin wont reactivate due to the following error:
Fatal error: Cannot redeclare NDScoutsGallery::update() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/ndscouts.php on line 115
This is the line of code it is referring to:
function update($new_instance, $old_instance) {
I have attempted to sort however was unsuccessful. Any assistance would be appreciated.
The update function is already created in word press, You can rename the function Name in NDScoutsGallery and call using updated function. It will work
Related
I am using WooCommerce on Wordpress 4.7.1. Previously, I was running 4.7.0. When Wordpress automatically upgraded to 4.7.1, I suddenly began seeing checkouts fail to redirect to the "Thank you" page, and the UI showed that a fatal error had occurred.
Turning on debugging revealed the following error:
PHP Fatal error: Cannot redeclare get_cc() (previously declared in .../templates/emails/email-addresses.php:36) in .../templates/emails/email-addresses.php on line 36
I also confirmed that this file is never directly called with require, require_once, include, or include_once. It is, however, called with wc_get_template().
A quick search brought me to this similar question. So I added the following to email-addresses.php:
if (!function_exists('get_cc')) {
function get_cc( $code ) {
... function body
}
}
After making this change, I now receive the following error in the debug log:
PHP Fatal error: Call to undefined function get_cc() in .../templates/emails/email-addresses.php on line 32
This means that, for whatever reason, PHP believes that the function get_cc already exists, but at the same time it is undefined.
I was not the original developer. I took over the project from a contractor who is not available. It does seem clear that this file is heavily modified from the original. I am certain that the value returned by the function must be kept, so I cannot just comment out the call.
Given the information above, what options do I have to either workaround or fix this issue?
It turns out that, unlike a standard function definition in PHP, function definitions wrapped in if (!function_exists('function_name')) { ... } block must precede any call to that function.
In this case, the function definition (line 36) followed the call (line 32). This caused the function to appear to PHP as undefined:
// Not working!
$value = get_cc($code);
if (!function_exists('get_cc')) {
function get_cc( $code ) {
...
}
}
Switching the order so that the function definition came first fixed the issue:
// Working!
if (!function_exists('get_cc')) {
function get_cc( $code ) {
...
}
}
$value = get_cc($code);
As of right now, PHP's documentation does not mention this issue.
I am trying to write a script that creates configurable products. Ive been using this as a guide: http://inchoo.net/magento/programmatically-create-a-configurable-magento-product/
When I get to this line:
$configurableAttributesData = $configProduct->getTypeInstance()->getConfigurableAttributesAsArray();
The script crashes and kicks out this error:
Fatal error: Call to a member function getId() on a non-object in /home/buyfrom/public_html/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 283
Following a comment on this page, I changed that line to the following:
$possibleAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
But I am still getting this error. Can anyone suggest how to fix this?
Make sure that attribute set (eg. default) which you are choosing is having at least one configurable attribute (example: 'color' or 'size').
I have created custom shipping module and gets following error:
Fatal error: Call to a member function setStore() on a non-object in /home/devjoand/public_html/includes/src/Mage_Shipping_Model_Shipping.php on line 421
I removed all files including .xml for this shipping module and it still gives me the same error. It doesn't send me to shipping method and stops execution from savebilling controller with above error. I have cleared cache/session and recompile but nothing works. Any help would be appreciated. Thanks in advance!
NOTE: It works fine in my local machine but not working on production server.
As described partially in the comments, the error comes from this code:
$obj = Mage::getModel($className);
if ($storeId) {
$obj->setStore($storeId);
}
In the code above $obj is set to null.
You stated that your removed a shipping carrier.
I think the problem appears because you didn't deactivate first the carrier.
So in the config table the carrier appears to be enabled but there is no model associated to it so the code above fails.
In order to fix this, look in the table core_config_data for a record with this path column: carriers/CARRIER_CODE_HERE/active, where CARRIER_CODE_HERE is the code of the shipping method you just removed.
When you find the line, remove it. Actually remove everything that has a path like carriers/CARRIER_CODE_HERE/%.
be sure to backup your database first in case I'm wrong.
I use codeigniter in my blog and since a while I get this error
PHP Fatal error: Call to a member function append_output() on a non-object in /var/www/site/blog/system/core/Loader.php on line 862
I don't know what change caused this and why it appears. The site gets rendered and send to browser completely, from views header.php, index.php to footer.php everything is there and after that this error appears. Search with google showed another site, that has this error at the very bottom of their site...
I now supressed the error with error_reporting(0) as the whole site works fine, but that's not a solution I want to stay with.
It happens on all pages, I have one Controler (blog.php) and several methods like index(), article(), archive() in it. The methods do what they are supposed to do, but when CI finished rendering the page, the error appears, with all controler methods.
What can I do to trace where this problem appears?
https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Loader.php#L938
If the error is occurring on the value returned from get_instance, here will be your problem. Although you may have to look at the version you are using to get the right line number.
Additionally:
https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Controller.php#L75
This appears to be the singleton class that function leads to, it is returning self::$instance which is created in the constructor.
To me this means the CI_Controller singleton has not been instantiated at the time that error has occurred.
Hope that helps you debug your problem.
I had the same problem. I'd overwritten the output class ($this->output) in my controller.
I am developing an agent-port application in CodeIgniter with PostgreSQL by using mutiple schemas from a single database. The setup I have designed is working fine.
So the problem I am facing right now is when after some interval it starts showing the following errors on different pages, like:
Fatal error: Call to a member function result() on a non-object in
D:\xampp\htdocs\mangonet\application\modules\settings\models\adminmodel.php
on line 30
Fatal error: Call to a member function num_rows() on a non-object in
D:\xampp\htdocs\mangonet\application\modules\users\models\adminmodel.php
on line 56
Fatal error: Call to a member function row() on a non-object in
D:\xampp\htdocs\mangonet\application\modules\users\models\adminmodel.php
on line 86
Let me give one example
I try to find out a particular problem only if it always remains there. But when I refresh my page or remove that row() from the function
function get_item_by_id($table, $id)
{
return $this->db->get_where($table, array('id' => $id))->row();
}
it returns a black result and when I add it back, the problem gone, and it starts working fine.
I know the above fatal errors you can see above solutions are available. But my problem is a bit complex.
This sounds like a problem with database connections going away. I would recommend looking at debugging this on the application side. In particular I would start logging the following:
Database connection status on all problematic calls. In other words check and see if the database connection has closed or failed.
If the database connection has not failed, then the next thing to check is what the search path is. You can execute the following query to test it:
SHOW search_path;
It is possible that if this is related to multiple schemas, something is messing with that.