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

2.0rc2 - fetch-statistics error #1664

Closed
Monica-Wood opened this issue Dec 23, 2024 · 5 comments
Closed

2.0rc2 - fetch-statistics error #1664

Monica-Wood opened this issue Dec 23, 2024 · 5 comments

Comments

@Monica-Wood
Copy link
Contributor

When running fetch-statistics with caUtils using 2.0rc2 tag, getting the following error

==> /var/log/nginx/error.log <==
2024/12/23 12:46:48 [error] 796346#796346: *23 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: array_shift(): Argument #1 ($array) must be of type array, null given in /var/www/providence/app/lib/Search/SearchResult.php:3345
Stack trace:
#0 /var/www/providence/app/lib/Search/SearchResult.php(3345): array_shift()
#1 /var/www/providence/app/lib/Service/StatisticsService.php(194): SearchResult->getMediaInfo()
#2 /var/www/providence/app/lib/Service/StatisticsService.php(53): StatisticsService::runStats()
#3 /var/www/providence/app/service/controllers/StatisticsController.php(39): StatisticsService::dispatch()
#4 /var/www/providence/app/lib/Controller/RequestDispatcher.php(289): StatisticsController->__call()
#5 /var/www/providence/app/lib/Controller/AppController.php(108): RequestDispatcher->dispatch()
#6 /var/www/providence/service.php(55): AppController->dispatch()
#7 {main}
  thrown in /var/www/providence/app/lib/Search/SearchResult.php on line 3345" while reading response header from upstream, client: 127.0.0.1, server: ***, request: "GET /service.php/Statistics/runStats?authToken=*** HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost"

Hidden server and authToken with ***

collectiveaccess added a commit that referenced this issue Dec 23, 2024
@collectiveaccess
Copy link
Owner

Just pushed a fix for this in dev/php8

@Monica-Wood
Copy link
Contributor Author

Fatal error: Uncaught TypeError: reset(): Argument #1 ($array) must be of type array, null given in /var/www/providence/app/lib/Search/SearchResult.php:3472 Stack trace: #0

This error is now showing.

I have done a bit more debugging on this one and it seems if the statistics user is given the administrators role, then things sort of work (I need to remove a couple of the arrays added here on lines 3345 and 3356 due to a reference error).
Even if I duplicate the administrators role permission into a statistics role, it just doesn't work, so I am lead to believe that something in the code is checking if the user has a particular role, rather than a particular permission.

@collectiveaccess
Copy link
Owner

It's due to the service not returning certain data the the role you're running it under does not have access to. We're not fully checking the returned data for existence here. Not sure why duplication of roles isn't working but will check.

@collectiveaccess
Copy link
Owner

I investigated in more detail and found some issues in how ACL is applied for the service, and how null values are handled when returned by the service. Just push changes to address all of this. Please try it when you can.

@Monica-Wood
Copy link
Contributor Author

Tested and working. Thank you

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

2 participants