Homegear / Homegear

Interface your smart home devices with your home automation software or your own control scripts.
https://homegear.eu
Other
122 stars 38 forks source link

new Homegear class seems to have a problem #207

Closed spali closed 9 years ago

spali commented 9 years ago

Script calls of the internal php engine drop the following message to the log since the new Homegear class is included (build 0.6.0-116):

05/07/15 14:37:23.129 Scriptengine (/var/lib/homegear/scripts/Homegear/VirtualDeviceProgrammHandler.php): PHP Warning:  Method Homegear::__call() cannot be static in Unknown on line 0
spali commented 9 years ago

I researched a bit. Seems to be that __call() is only available for non-static invocations. __callStatic() (http://ee1.php.net/language.oop5.overloading#object.callstatic) seems to be the way for static invocations.

But I don't understand why the warning is printed even no call of the method was made in my script. Do you call it already internally?

By the way, how to use the class? Is it the meaning to call everything statically like:

<?php
var_dump(Homegear::getSystemVariable('myvariable'));
?>

Or is the meaning to create an instance of the class to call it?

<?php
$homegear = new Homegear();
var_dump($homegear->getSystemVariable('myvariable'));
?>

If you call internal functions directly and not using "pseudo" RPC-calls, then static should be fine, right?

hfedcba commented 9 years ago

Hey,

I didn't implement __callStatic, only __call. But now __callStatic is implemented, too ;-). __call was defined as static, too - I have so much output in my current test installation, that I overlooked the warning...

Cheers,

Sathya

spali commented 9 years ago

tested and no warnings anymore :) thanks