Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging error Declaration of OCA\Grauphel.. must be compatible.. #100

Open
praet0ri4n opened this issue Mar 13, 2023 · 1 comment
Open

Comments

@praet0ri4n
Copy link

After upgrading to [Nextcloud Hub 3] (25.0.4) and Grauphel 1.0.18 i receive plenty of errors in NC Logging:

Declaration of OCA\Grauphel\Search\Provider::search(OCA\Grauphel\Search\OCP\IUser $user, OCA\Grauphel\Search\OCP\Search\ISearchQuery $query) must be compatible with OCP\Search\IProvider::search(OCP\IUser $user, OCP\Search\ISearchQuery $query): OCP\Search\SearchResult at /var/www/html/custom_apps/grauphel/lib/Search/Provider.php#44
At the same time clients are experiencing sync problems, they cannot connect.

On previous versions there were no such errors, but as I upgraded Nextcloud and Grauphel at the same time I can't specify which one was the cause now.
Thank you for hints and help!

@praet0ri4n
Copy link
Author

I made custom research and found out, that the culprit lies in profound differencies in the versions maintained by Nextcloud, especially the 1.0.18
https://apps.nextcloud.com/apps/grauphel
and the current code state in this git repo..

The error above comes from missing ": SearchResult" in the
var/www/html/custom_apps/grauphel/lib/Search/Provider.php#44
file
public function search(OCP\IUser $user, OCP\Search\ISearchQuery $query)
and the correct way
public function search(IUser $user, ISearchQuery $query) : SearchResult
This file is from the official version 1.0.18. The Provider.php in this git codebase is correct.

By correcting the missing declaration there is a waterfall off other errors only revealing themselves after this fix.
The next is
Could not check compatibility between OCA\Grauphel\Search\Provider::search(OCA\Grauphel\Search\OCP\IUser $user, OCA\Grauphel\Search\OCP\Search\ISearchQuery $query): OCA\Grauphel\Search\OCP\Search\SearchResult and OCP\Search\IProvider::search(OCP\IUser $user, OCP\Search\ISearchQuery $query): OCP\Search\SearchResult, because class OCA\Grauphel\Search\OCP\IUser is not available at /var/www/html/custom_apps/grauphel/lib/Search/Provider.php#44
This again has to do with the "OCP\IUser" namespace declaration in the search function. It has to be "IUser" only.
Again this occurs only in official version.

After fixing IUser there is another one
Undefined constant OCA\Grauphel\AppInfo\Application::APP_ID in file '/var/www/html/custom_apps/grauphel/lib/Search/Provider.php' line 27
(fixed in current git code, it is a missing declaration in AppInfo/Application.php..)
and
Undefined constant OCA\Grauphel\Search\Provider::ORDER in file '/var/www/html/custom_apps/grauphel/lib/Search/Provider.php' line 46
which I did not find anywhere what it is meant to do. For testing I replaced
return self::ORDER;
with
return 1;
The self::ORDER constant is not being defined anywhere..

I updated the whole app code to this git code here but then there is another errors:
Undefined property: OCA\Grauphel\Search\Provider::$lutil at /var/www/html/custom_apps/grauphel/lib/Search/Provider.php#36
So again for the sake of testing i replaced
return $this->lutil->l10n->t('Grauphel');
with
return 'Grauphel';

Sorry for pasting all the errors and quirks here, but hopefully somebody makes use of it and maybe there is an update which could solve all this in one go.
Thank you grosjo for taking over this awesome project :)

ramcq added a commit to ramcq/nextcloud-grauphel that referenced this issue Aug 31, 2023
Apply some chages to the search provider following suggestions in grosjo#100 and example in https://docs.nextcloud.com/server/27/developer_manual/digging_deeper/search.html.
ramcq added a commit to ramcq/nextcloud-grauphel that referenced this issue Aug 31, 2023
Following grosjo#100 and
https://docs.nextcloud.com/server/27/developer_manual/digging_deeper/search.html
try to return valid search results using SearchResult and SearchResultEntry.
Correct invalid references in getName() and getOrder(). Remove unused
Notes class and tidy whitespace.
ramcq added a commit to ramcq/nextcloud-grauphel that referenced this issue Aug 31, 2023
Following grosjo#100 and
https://docs.nextcloud.com/server/27/developer_manual/digging_deeper/search.html
try to return valid search results using SearchResult and SearchResultEntry.
Correct invalid references in getName() and getOrder(). Remove unused
Notes class and tidy whitespace.
ramcq added a commit to ramcq/nextcloud-grauphel that referenced this issue Aug 31, 2023
Following grosjo#100 and
https://docs.nextcloud.com/server/27/developer_manual/digging_deeper/search.html
try to return valid search results using SearchResult and SearchResultEntry.
Correct invalid references in getName() and getOrder(). Remove unused
Notes class and tidy whitespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant