Invoking wsclient_service_load function in Drupal - php

I'm trying to invoke this function in a Drupal custom module:
wsclient_service_load('my_web_service');
And it returns an error:
Fatal error: Call to undefined function wsclient_service_load() in...
But if I invoke the same function from page.tpl.php it works fine.
I must being missing something really basic.
Hope someone can enlight me.
Thanks

Related

IsSMTP() in phpmailer function

****Fatal error: Call to a member function IsSMTP() on a non-object****
I get this error in my program. I have tried $mail=isSMTP(true);
Please help me understand why this error occurs and how I can resolve this error
You need to create an instance of an object before you call methods on it, and post your whole code when asking a question on SO.

PHP class fatal error call to undefined function stuck globally

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?

Redeclare function works on old server but not new

I'm migrating a PHP 5.2.x application to a new 5.2.x server. The old server actually started as a PHP 4.0 server many years ago and was upgrade to PHP 5.2 over time. One of our modules has a function that gets redeclared if this module is used more than once. We can easily fix this, but we're perplexed at how it ever could have worked.
On the new server it will fail with an expected:
Fatal error: Cannot redeclare function
The problem is that on the old server it was always re-declaring the function! Is there a PHP setting or special usage being used here that makes it work on one server but not another?
Thank you!
Edit Still trying to pour through how this is possible. The site FATAL errors but has execution after that point of error.
Redeclaring functions is consider a error.
Maybe you guys can use "rename function".
http://es.php.net/manual/en/function.rename-function.php
if(function_exist("foo")){
rename_function('foo', 'old_foo' );
function foo(){
/*...*/
}
}
Another idea is to rewrite code to do this
$foo = function(){ /* something */.... };
So the next time you want to redefine $foo(), you do
$foo = function(){ /* something else */.... };
I am unable to reproduce your description, PHP 4 does not allow you to redeclare functions:
echo PHP_VERSION;
function foo() {}
function foo() {}
Demo/Output:
4.4.9
Fatal error: Cannot redeclare foo() (previously declared in /homepages/26/d94605010/htdocs/lz/writecodeonline.com/php4/index.php(138) : eval()'d code:2) in /homepages/26/d94605010/htdocs/lz/writecodeonline.com/php4/index.php(138) : eval()'d code on line 3
You must mix things here, so better find out more about facts when debugging, not guessing (yes I know can be hard sometimes, but facts help when debugging, aim for them).
And if it's a fatal error, your script ends. You can add a shutdown callback function to further debug your issue, see a related question:
PHP : Custom error handler - handling parse & fatal errors

Joomla component function deprecated

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.

Codeigniter PHP Fatal error: Call to a member function item() on a non-object when call $this->config->item(‘config_item’)

$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.

Categories