I need to fix a php scripts that will generate some xls file using PHP and an input xls file.
I didn't created originally the script so I don't know exactly what version of PHP spreadsheet was used but at the moment I will get this error on the screen
Fatal error: __clone method called on non-object
It's related to this line of code
$clonedWorksheet = clone $spreadsheet->getSheetByName('struttura');
I've tried to do a var_dump on the $clonedWorksheet and I can see that it's an object, so the error is unexplainable.
Is there a way to clone the object in another way or to fix this problem?
Related
In debugging some code I've mistakenly made a call to a member function on a non-object, giving the expected Call to a member function get() on a non-object in /path/to/file.php on line X. I'm accustomed to this, while PHP isn't my favorite language I've been working with it for years. What's confusing me is that when I remove the offending code (I'm using version control and resetting to what should be a working state prior to the bad call), I still get the error. Is it possible for this error to have corrupted an in-memory (I'm using APC object caching). I feel like the answer might be "yes, maybe", however I honestly don't think that explains the problem and am wondering if anyone else has encountered something similar? Is there a method to somehow reset this PHP class object?
Deployed application to production and running into the following error on views that contain a call to a render function:
Fatal error: No matching function for overloaded 'render'
Example
/fuel/app/views/profile.php:
echo render('_validation');
Render is defined in /fuel/core/classes/view.php. The Autoloader should be making this available.
Ideas on environmental issues that may be causing this?
Edit: Both APPPATH and COREPATH hold the correct file paths
Try to use more clear function names, so you won't get in trouble with standart PHP functions.
It looks like your render-function is declared inside a class, if it is so you have to initialize an object of that class or use an existing object to call the method
echo $object->render('_validation');
Unsure if it is an issue specific with 5.3.3 but we just changed render() to View::forge() across the applications and all is well.
I am using a Joomla component com_fabrik but though its install successfully. As I try to create form I am getting following error.
Fatal error: Call to a member function setId() on a non-object in C:\xampp\htdocs\sankalpJoomla\administrator\components\com_fabrik\models\form.php on line 108
When I searched for code in file I got.
$feFormModel->setId($this->getState('form.id'));
I searched that function is deprecated. is their any other option to sort out problem?
While it may be that the function is deprecated, the error you're getting isn't related to that (at least not directly). What is happening is $feFormModel isn't an actual object, and because of that it has no memeber functions. So when setId() is being called from it, this error is being thrown.
The likely cause is some sort of incompatibility between this component and the version of Joomla you're using.
$this->config->item('config_item')
PHP Fatal error: Call to a member function item() on a non-object
Anyone knows how to fix this kind of problem? Or anyone ever been had same stuff?
The error happens on every call of config item rather in libraries classes (e.g. form_validation class) or in application controller.
If I print_r($this->config) it shows array of config content.
I'm getting a PHP Fatal error: Cannot redeclare class Foo in /directory/ on line 20 error, but I have no idea where it's coming from. I'm always using require_once for this class file, and I'm not sure how to debug it. Can I get some kind of inclusion stack trace somehow? I'm running PHP 5, so case sensitivity such as descriped here should not be a problem: http://www.php.net/manual/en/function.include-once.php.
Use debug_backtrace in file where is class declared, but before it's declaration
Another approach is to rename the class that was redefined (also rename the file containing the class) and then fix all class-not-found errors you get from that. That should lead you to the code that is causing the redefinition. In my case it was a class_alias statement that was causing the problem.