Hallo Nall-chan,
ich habe heute morgen weiter versucht und kann den Zusammenhang mit opt. Parametern nicht herstellen.
Umfass einfach nachstellen zu können habe ich ein Modul angelegt (GitHub - demel42/Test)
Das enthält eine FUnktion
public function TestFunc()
{
return 'abc';
}
Modul ganz normal installiert, ein Script angelegt
<?
echo Test_TestFunc(56880 /*[Test]*/);
Ausgabe ist natürlich „abc“;
Dann habe ich die Funktion geändert
public function TestFunc(string $s)
{
return 'abc';
}
dann
<?
MC_ReloadModule(31892 /*[Modules]*/, 'Test');
im Logfile kommt:
22.07.2019 10:27:20 | 00000 | MESSAGE | ModuleLoader | #Modul entladen: Test
22.07.2019 10:27:20 | 00000 | MESSAGE | ModuleLoader | #Bibliothek entladen: Test
22.07.2019 10:27:20 | 00000 | MESSAGE | ModuleLoader | Überspringe Built-In Bibliothek…
…
2.07.2019 10:27:20 | 00000 | MESSAGE | ModuleLoader | Lade Test Bibliothek…
22.07.2019 10:27:20 | 00000 | MESSAGE | ModuleLoader | # Test geladen
22.07.2019 10:27:20 | 00000 | MESSAGE | PHPLibrary | Registriere Funktionen… TEST_TestFunc
22.07.2019 10:27:20 | 00000 | MESSAGE | PHPLibrary | Registriere Funktion… TEST_TestFunc: Nicht registrierbare Funktion TEST_TestFunc: Parameter count does not match
trotzdem ein Versuch:
<?
echo Test_TestFunc(56880 /*[Test]*/, 'def');
[Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::TestFunc(), 0 passed in /var/lib/symcon/scripts/__generated.inc.php on line 5067 and exactly 1 expected in /var/lib/symcon/modules/Test/Test/module.php:34
Stack trace:
#0 /var/lib/symcon/scripts/__generated.inc.php(5067): Test->TestFunc()
#1 /var/lib/symcon/scripts/48712.ips.php(3): TEST_TestFunc(56880, ‚def‘)
#2 {main}
thrown in /var/lib/symcon/modules/Test/Test/module.php on line 34
Eintrag in __generated.inc.php:
function TEST_TestFunc($InstanceID)
{
if(IPS_GetInstance($InstanceID)["ModuleInfo"]["ModuleID"] == "{B85F0CC0-5764-4A5B-9E6F-069CE00C46C4}") {
require_once('/var/lib/symcon/modules/Test/Test/module.php');
$result = (new Test($InstanceID))->TestFunc();
}
elseif(IPS_GetInstance($InstanceID)["ModuleInfo"]["ModuleID"] == "{B85F0CC0-5764-4A5B-9E6F-069CE00C46C4}") {
require_once('/var/lib/symcon/modules/Test/Test/module.php');
$result = (new Test($InstanceID))->TestFunc();
}
else {
throw new Exception("Instance does not implement this function");
}
return $result;
}
Meine Umgebung ist Ubuntu und Raspberry, dieser Versuch ist unter IPS 5.0 (IP-Symcon 5.0, Ubuntu, 13.12.2018, 93cb63bbeb25)
Was mache ich falsch, was kann ich noch testen?
Gruß
demel