API doesn't work in 1.5.9 dev. Error in route.class.php
-
We have upgraded a Ubuntu 18 server that was running 1.5.7 to Ubuntu 22.04 and FOG 1.5.9 dev branch (required because of PHP version check).
The UI works, but any call to the API fails, the Apache error log shows this:
Got error 'PHP message: PHP Fatal error: Uncaught Error: Unknown named parameter $method in /var/www/fog/lib/router/route.class.php:351\nStack trace:\n#0 /var/www/fog/lib/router/route.class.php(231): Route::runMatches()\n#1 /var/www/fog/api/index.php(23): Route->__construct()\n#2 {main}\n thrown in /var/www/fog/lib/router/route.class.php on line 351'
Is this easy to fix?
Otherwise, do you already have a timeline for a new FOG release that works on Ubuntu 22? -
@abulhol Upgrading the OS that FOG runs on has mixed results. Sometimes it works, but usually does not. Generally it’s not advised to upgrade the OS to a new major version due to this. It’s usually advised to migrate your FOG server to a new home that has the new OS. There’s a guide for this, and you should still be able to do this even though your old FOG server is broke. https://wiki.fogproject.org/wiki/index.php?title=Migrate_FOG
-
@wayne-workman Hi, thanks for the tip.
In case we’re not in the position to migrate to a new server. What are you suggesting ?
A) Doing all the backup (for the migration), then uninstalling/removing FOG, then upgrade the OS to reinstall fog after then upgrade ?
or
B) Upgrade FOG to the latest version, then upgrade the OS ?I can understand that a “proper” migration is always better, but that wouldn’t be far from removing all, then re-install properly, right ?
-
@nono I’m not suggesting either of the options you listed, I suggest to migrate to a new box.
-
@wayne-workman Actually the migration seemed to have worked very well overall, given that we used the dev branch.
The web UI works fine, it’s only the API that is returning errors.
So to me it looks more like a PHP problem not related to our instance specifically.
We will likely wait for your next release that officially supports Ubuntu 22, but we would very much appreciate if you could take a look at the API issue. -
@wayne-workman I have looked at your daily tests, it looks like they only confirm that the installer runs successfully.
Do you have automated tests for the API? Please let me know when you have had a look at this. -
@abulhol said in API doesn't work in 1.5.9 dev. Error in route.class.php:
Do you have automated tests for the API?
I do not. But, if someone created some I would be happy to add them to the daily tests.
-
@wayne-workman I don’t have enough time to work on creatingmore tests, but I had a look at the PHP issue myself.
It is because of a breaking change in PHP 8:
https://php.watch/versions/8.0/named-parameters#named-params-call_user_func_arrayIt comes into play when
call_user_func_array
is used.I’ll try to fix this myself as suggested in the link and create a PR on Github.
-
PR created in dev-branch
-
@abulhol Thanks for looking into the error and fixing the issue via the github PR. Merge is done.