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

1014 errors in the logs since 3. Juli 2024, 18:46:13 Undefined array key #249

Open
kruthoff opened this issue Jul 10, 2024 · 10 comments
Open

Comments

@kruthoff
Copy link

cms_pico produces many errors in nextcloud.log, such as

{"reqId":"KnV3So1DBNZHzppo8HZ9","level":3,"time":"2024-07-10T18:35:09+02:00","remoteAddr":"192.168.1.175","user":"<user>","app":"PHP","method":"GET","url":"/index.php/apps/cms_pico/pico_proxy/<site>/","message":"Undefined array key \"\" at /var/www/html/nextcloud/lib/private/AppFramework/Http.php#128","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0","version":"29.0.3.4","data":{"app":"PHP"}}

I'm running it with php-8.2. Does anybody know how this can be fixed? I assume it's not too complicated, but I'm not a php developer, unfortunately.

Any help is much appreciated.

@PhrozenByte
Copy link
Collaborator

Please provide a full stacktrace from the logfile of that error.

@kruthoff
Copy link
Author

kruthoff commented Jul 12, 2024

nextcloud-undefined-array-key
[PHP] Error: Undefined array key "" at /var/www/html/nextcloud/lib/private/AppFramework/Http.php#128
GET /index.php/apps/cms_pico/pico_proxy/andreas_kruthoff/
from 194.195.253.114 by -- at 12.07.2024, 14:18:49

That's it.

This comment was marked as outdated.

@kruthoff
Copy link
Author

Error handling for this case if the array key is undefined, or figure out why the key is undefined and define it, maybe.

@PhrozenByte
Copy link
Collaborator

or figure out why the key is undefined and define it

You might figure that out, yes.

As I said, since I can't reproduce it and without you providing a full stacktrace, its literally impossible for me to find the root cause of this error thrown in Nextcloud's code. You might want to report the error in nextcloud/server, too; no matter what the app does, nextcloud/server should properly handle a non-existing key.

@kruthoff
Copy link
Author

How can I provide a full stack trace? In loglevel 0, I get some more messages, but I don't know if it helps.

{"reqId":"14GfWWNsSVqREQLM13gN","level":0,"time":"2024-07-21T18:07:32+02:00","remoteAddr":"192.168.1.175","user":"andreas","app":"cms_pico","method":"GET","url":"/apps/files/api/v1/stats","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"29.0.4.1","data":{"app":"cms_pico"}}

and

{"reqId":"lkOkRMpFGDdrvRSHRHLk","level":0,"time":"2024-07-21T18:01:07+02:00","remoteAddr":"192.168.1.175","user":"andreas","app":"PHP","method":"GET","url":"/index.php/apps/cms_pico/pico_proxy/andreas_kruthoff/","message":"trim(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/html/nextcloud/apps/cms_pico/vendor/symfony/yaml/Inline.php#49","userAgent":"Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"29.0.4.1","data":{"app":"PHP"}}
{"reqId":"lkOkRMpFGDdrvRSHRHLk","level":0,"time":"2024-07-21T18:01:07+02:00","remoteAddr":"192.168.1.175","user":"andreas","app":"PHP","method":"GET","url":"/index.php/apps/cms_pico/pico_proxy/andreas_kruthoff/","message":"Function strftime() is deprecated at /var/www/html/nextcloud/apps/cms_pico/vendor/picocms/pico/lib/Pico.php#1527","userAgent":"Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"29.0.4.1","data":{"app":"PHP"}}

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! 👍

@doftnet
Copy link

doftnet commented Dec 17, 2024

I just recently updated from NC 27 to 30 and started seeing this issue. Dug into it and found that in [nextcloud apps directory]/cms_pico/lib/Http/PicoPageResoponse.php in the constructor, there is an if statement:

if ($page->is404Content()) {
       $this->setStatus(Http::STATUS_NOT_FOUND);
}

I added an else to set the status to STATUS_OK:

if ($page->is404Content()) {
    $this->setStatus(Http::STATUS_NOT_FOUND);
} else {
    $this->setStatus(Http::STATUS_OK);
}

This seems to have resolved the issue.

@PhrozenByte
Copy link
Collaborator

Thanks @doftnet, reopening as bug now. However, please note that cms_pico isn't under active development right now and thus it's - as of now - unlikely that there's going to be a bugfix release (you can naturally still patch it yourself and keep using that self-patched version).

@doftnet
Copy link

doftnet commented Dec 17, 2024

I kinda figured that was the case. That if statement was added in my PR from 5 years ago so the least I could do is share a fix with the community.

@PhrozenByte PhrozenByte reopened this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants