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.
Related
I've got a site on Codeigniter 2 and when I switch server's version to PHP7 I get the following two errors:
A PHP Error was encountered
Severity: Notice
Message: Only variables should be assigned by reference
Filename: core/Controller.php
Line Number: 51
$this->load->_base_classes =& is_loaded();
A PHP Error was encountered
Severity: 8192
Message: Methods with the same name as their class will not be constructors in a future version of PHP; CI_DB_driver has a deprecated constructor
Filename: database/DB_driver.php
Line Number: 31
Does anyone know how to fix them?
Eventually I just updated CI core to CodeIgniter 2.2.6. Had to change DB driver to mysqli (since mysql is no longer supported in php7) and re-added the ci_sessions table in database (no idea why). And works like a charm!
Only variables should be assigned by reference
This error isn't PHP 7-exclusive, you'd get it in older versions too. Anyway, I think the issue here is in is_loaded() and it is not returning a reference properly. Does it return by-reference (is it like function &is_loaded())? If not, it needs to. Does it return a variable or an expression? If it's not a variable, you need to put it in one before you can return a reference to it.
PHP manual page for this error: http://php.net/manual/en/language.references.return.php
Methods with the same name as their class will not be constructors in a future version of PHP; CI_DB_driver has a deprecated constructor
In PHP 4, you made a constructor method by naming it the same as the class. So if your class was class FooBar, your constructor would be public function FooBar. In PHP 5 and beyond, though, the recommended name for a constructor is __construct. So, go and edit that class and rename its constructor to get rid of the deprecation errors. Be sure to look at any extending classes to see if they call that constructor method, too, so you can change them.
See the upgrading guide: http://php.net/manual/en/migration70.deprecated.php
Also see the RFC: https://wiki.php.net/rfc/remove_php4_constructors
This is confusing because I've checked other answers and applied them, but I still keep getting this fatal error.
I'm using phpmailer in wordpress and have this code:
if (!class_exists('PHPMailer')) {
require_once(ABSPATH . 'wp-content/uploads/phpmailer/_lib/class.phpmailer.php');
}
The page doesn't load, however, and I get the error:
PHP Fatal error: Cannot redeclare class PHPMailer in
(I also tried class_exists('PHPMailer', false)) but that also produced the same error.)
As far as I can see, by checking the class does not exist and then using require_once I shouldn't have this problem.
But I do...
Any help appreciated.
PHPMailer instance already working in wordpress. You do not need to include library again. Check this link for your reference
https://codex.wordpress.org/Plugin_API/Action_Reference/phpmailer_init
I think this is probably a simpler issue than namespaces: class_exists takes a second autoload parameter that defaults to true, and it means that it will automatically attempt to load the class if it's not already loaded and it can find it in your include_path. The net result is that by leaving that param at its default value, you're effectively loading it twice, hence the redeclaration error. Try this instead:
if (!class_exists('PHPMailer', false)) {
require_once(ABSPATH . 'wp-content/uploads/phpmailer/_lib/class.phpmailer.php');
}
In other news: use composer. It manages all your class loading for you. It's worth it for even trivial scripts.
I'm getting this error message
Attempted to call function "openssl_pkey_get_private" from namespace "WAYF"
I'm upgrading the symfony version from symfony2 to symfony3, and "WAYF" is my bundle and
In that I have one class name as "CustomLogin.php"
in that class I have declared one function "function prepareparamsforjs(){}" and
in that function I'm calling "openssl_pkey_get_private()" function with arguments "$privatekey" and "$privatekeypass" to get a private Key
but I'm getting above error message.
Can anybody tell me how to solve this issue.
Thanks in Advance!...
IMHO you don't have the OpenSSL extension (http://php.net/manual/en/book.openssl.php) loaded in PHP, so the parser is trying to find it inside the current namespace, which is the WAYF.
A quick way to verify if the OpenSSL extension is loaded is to run:
var_dump(extension_loaded('openssl'));
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?
Does anyone have a clue about this? PHP 5.2.13. Results not wholly consistent i.e. could get a good result with a page at one time, then get an error at another.
The error is fatal - class does not have method.
But the following are true:
The class is defined in only one place and has the relevant method in the code.
At the point where failure occurs: reflection shows that the method exists.
At the point where failure occurs: method_exists says the method does not exist.
Previous calls (they're all static - not my choice) earlier in the code worked.
May be it's related: http://bugs.php.net/bug.php?id=51425
But I think here we have some cache-related problem. Do you have some cache enabled? Like APC or any other accelerators?
Be sure that the file containing the method is included. If the method is in a class, make sure the class instance is created and the method is called through the class.
Maybe you are missing the class instance?