Page 1 of 1

API: FTP User erstellen - 500 Internal Server error

Posted: Thu 9. Apr 2026, 09:18
by linus
Ich bin sicher, dass die Ursache des Problems bei KeyHelp liegt
Ja, Core-Bug


Server-Betriebssystem + Version
Debian 13.4


Eingesetzte Server-Virtualisierung-Technologie
KVM


KeyHelp-Version + Build-Nummer
z.B. 26.0 - Build 3618

Problembeschreibung / Fehlermeldungen
- Beim Erstellen eines FTP-Benutzers via API kommt es zum Internal Server Error

Beispiel Request:

Code: Select all

POST https://keyhelp-server/api/v2/ftp-users

JSON:
        "id_user": 60,
        "username": "box_testuser",
        "password": "************",
        "home_directory": "/files/test",
        "description": "test"
Response 500 - Internal Server Error

Code: Select all

[09-Apr-2026 08:24:06 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Ftp\FtpUser::getHomeDirectory(): Return value must be of type string, null returned in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php:143
Stack trace:
#0 /home/keyhelp/www/keyhelp/core/Api/ApiController/ApiControllerFtpUsers.php(237): Ftp\FtpUser->getHomeDirectory()
#1 /home/keyhelp/www/keyhelp/api/api.php(315): Api\ApiController\ApiControllerFtpUsers->createAndUpdate()
#2 {main}
  thrown in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php on line 143
[09-Apr-2026 08:25:36 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Ftp\FtpUser::getHomeDirectory(): Return value must be of type string, null returned in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php:143
Stack trace:
#0 /home/keyhelp/www/keyhelp/core/Api/ApiController/ApiControllerFtpUsers.php(237): Ftp\FtpUser->getHomeDirectory()
#1 /home/keyhelp/www/keyhelp/api/api.php(315): Api\ApiController\ApiControllerFtpUsers->createAndUpdate()
#2 {main}
  thrown in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php on line 143
  

Erwartetes Ergebnis
200 / 201

Tatsächliches Ergebnis
500

Schritte zur Reproduktion
- FTP Benutzer via API erstellen

Zusätzliche Informationen
(z.B. kürzlich durchgeführte Änderungen am Server, Auszüge aus Protokolldateien (/var/log/*, /var/log/keyhelp/php-error.log, etc.))


Lg Linus

Re: API: FTP User erstellen

Posted: Thu 9. Apr 2026, 09:41
by Tobi
Existiert das Verzeichnis?

Hast du es auch schon mit

Code: Select all

"home_directory": "/files/test/"
probiert?

https://app.swaggerhub.com/apis-docs/ke ... _ftp_users

Re: API: FTP User erstellen - 500 Internal Server error

Posted: Thu 9. Apr 2026, 09:47
by linus
Danke für die schnelle Rückmeldung.

Das Problem entsteht unabhängig davon, ob der Parameter gesetzt ist oder nicht.
Bei einem Test auf /files, /www, /files/, /www/ kommt es zum gleichen Fehler.
Selbst ohne

Code: Select all

home_directory
Parameter kommt es zu der genannten PHP Exception.

Aufgrund der Ioncube-Verschlüsselung kann ich das eigentliche Problem nicht identifizieren.

Re: API: FTP User erstellen - 500 Internal Server error  [GELÖST]

Posted: Thu 9. Apr 2026, 10:01
by Alexander
Danke fürs Melden.
Ich hab die Ursache gefunden und mache in den nächsten Minuten den Patch fertig.

Zum installieren: Konfiguration -> Patch-Manager

Edit: Patch ist live.

Re: API: FTP User erstellen - 500 Internal Server error

Posted: Thu 9. Apr 2026, 11:19
by linus
Ganz herzlichen Dank für den super schnellen Patch!
Der Patch funktioniert einwandfrei.

Eine Kleinigkeit ist mir noch aufgefallen:
In der v1 API, sowie im GUI Bereich ist keine Beschreibung für den FTP Benutzer erforderlich. Ein "NULL" Wert war mit v1 möglich, ist im v2 aber nicht mehr erlaubt:

Code: Select all

[09-Apr-2026 11:15:04 Europe/Berlin] PHP Fatal error:  Uncaught TypeError: Ftp\FtpUser::setDescription(): Argument #1 ($description) must be of type string, null given, called in /home/keyhelp/www/keyhelp/core/Api/ApiController/ApiControllerFtpUsers.php on line 280 and defined in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php:245
Stack trace:
#0 /home/keyhelp/www/keyhelp/core/Api/ApiController/ApiControllerFtpUsers.php(280): Ftp\FtpUser->setDescription()
#1 /home/keyhelp/www/keyhelp/api/api.php(315): Api\ApiController\ApiControllerFtpUsers->createAndUpdate()
#2 {main}
  thrown in /home/keyhelp/www/keyhelp/core/Ftp/FtpUser.php on line 245
Falls möglich sollte daher description auch wieder nullable sein

Re: API: FTP User erstellen - 500 Internal Server error

Posted: Thu 9. Apr 2026, 11:47
by Alexander
Mach ich gleich noch als separaten Patch fertig, so das das Verhalten wieder wie vorher ist.

Edit: Patch ist live

Re: API: FTP User erstellen - 500 Internal Server error

Posted: Thu 9. Apr 2026, 12:08
by linus
Vielen Dank!