13
39
Fork
You've already forked forte
10

fix POST 500 issue: get locationRecord webfinger string #38

Merged
streams merged 1 commit from abanink/forte:fix-POST-500-store-actor-webfinger-addr into dev 2025年08月02日 22:54:17 +02:00
Collaborator
Copy link

after upgrading to v25.8.1, I found this kind of errors in my php log:

4DYzuLWNn6hqbRGkT5S/actor/inbox HTTP/2.0", upstream: "fastcgi://unix:/run/phpfpm/forte.sock:", host: "forte.eenoog.org"
2025年08月02日 19:10:49 [error] 317493#317493: *6021 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: PDO::quote(): Argument #1 ($string) must be of type
 string, array given in /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_pdo.php:135
Stack trace:
#0 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_pdo.php(135): PDO->quote()
#1 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_driver.php(286): dba_pdo->escape()
#2 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/misc.php(3740): dbesc()
#3 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/hubloc.php(57): update_table_from_array()
#4 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Lib/Activity.php(3192): hubloc_store_lowlevel()
#5 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Lib/Activity.php(2730): Code\Lib\Activity::updateLocations()
#6 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Module/Inbox.php(140): Code\Lib\Activity::actor_store()

I added some logging and found this in forte logs:

2025年08月02日T20:15:26Z:LOG_INFO:c08c9ddfad:Activity.php:3193:updateLocations: Going to call hubloc_store_lowlevel for this record: Array
(
 [hubloc_guid] => did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU
 [hubloc_hash] => did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU
 [hubloc_id_url] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor
 [hubloc_addr] => Array
 (
 [@context] => Array
 [id] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor
 [type] => Group
 [attachment] => Array
 [name] => Forte Announcements
 [generator] => Array
 [icon] => Array
 [image] => Array
 [published] => 2025年02月15日T15:51:54Z
 [summary] => Announcements: releases, known issues, upgrades of test sites, ...
 [tag] => Array
 [updated] => 2025年02月15日T15:51:54Z
 [url] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor
 [canSearch] => Array
 [inbox] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/inbox
 [outbox] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/outbox
 [followers] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/followers
 [following] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/following
 [permissions] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/permissions
 [endpoints] => Array
 [publicKey] => Array
 [preferredUsername] => forte-announcements
 [alsoKnownAs] => Array
 [discoverable] => 1
 [manuallyApprovesFollowers] => 1
 [webfinger] => forte-announcements@forte.eenoog.org
 [indexable] => 
 ...

So the hubloc_addr is an array, and dbesc will fail on it. It should be a string.
I traced that back to this commit:
f96eae6169

The change in this PR is to take the "webfinger" field from the locationRecord array, as this is my best guess at the intention here.

after upgrading to v25.8.1, I found this kind of errors in my php log: ```while reading response header from upstream, client: 192.168.1.2, server: forte.eenoog.org, request: "POST /.well-known/apgateway/did:key:z6MkqoFytvPRvmTJrRcGvPs2BAeNf 4DYzuLWNn6hqbRGkT5S/actor/inbox HTTP/2.0", upstream: "fastcgi://unix:/run/phpfpm/forte.sock:", host: "forte.eenoog.org" 2025年08月02日 19:10:49 [error] 317493#317493: *6021 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: PDO::quote(): Argument #1 ($string) must be of type string, array given in /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_pdo.php:135 Stack trace: #0 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_pdo.php(135): PDO->quote() #1 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/dba/dba_driver.php(286): dba_pdo->escape() #2 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/misc.php(3740): dbesc() #3 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/include/hubloc.php(57): update_table_from_array() #4 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Lib/Activity.php(3192): hubloc_store_lowlevel() #5 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Lib/Activity.php(2730): Code\Lib\Activity::updateLocations() #6 /nix/store/hqs0yjink0h897il5wkdc6ifd48lvy2i-forte-v25.8.1/src/Module/Inbox.php(140): Code\Lib\Activity::actor_store() ``` I added some logging and found this in forte logs: ``` 2025年08月02日T20:15:26Z:LOG_INFO:c08c9ddfad:Activity.php:3193:updateLocations: Going to call hubloc_store_lowlevel for this record: Array ( [hubloc_guid] => did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU [hubloc_hash] => did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU [hubloc_id_url] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor [hubloc_addr] => Array ( [@context] => Array [id] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor [type] => Group [attachment] => Array [name] => Forte Announcements [generator] => Array [icon] => Array [image] => Array [published] => 2025年02月15日T15:51:54Z [summary] => Announcements: releases, known issues, upgrades of test sites, ... [tag] => Array [updated] => 2025年02月15日T15:51:54Z [url] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor [canSearch] => Array [inbox] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/inbox [outbox] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/outbox [followers] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/followers [following] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/following [permissions] => https://forte.eenoog.org/.well-known/apgateway/did:key:z6MkqumtRrRUQwVTyj81y2DBWxK7Dg72gmj15mksw9vapAcU/actor/permissions [endpoints] => Array [publicKey] => Array [preferredUsername] => forte-announcements [alsoKnownAs] => Array [discoverable] => 1 [manuallyApprovesFollowers] => 1 [webfinger] => forte-announcements@forte.eenoog.org [indexable] => ... ``` So the hubloc_addr is an array, and dbesc will fail on it. It should be a string. I traced that back to this commit: https://codeberg.org/fortified/forte/commit/f96eae61692736a4a20209200a59d4a8a13cfe9a The change in this PR is to take the "webfinger" field from the locationRecord array, as this is my best guess at the intention here.
streams left a comment
Copy link

Was just looking for what caused that. Thanks.

Was just looking for what caused that. Thanks.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fortified/forte!38
Reference in a new issue
fortified/forte
No description provided.
Delete branch "abanink/forte:fix-POST-500-store-actor-webfinger-addr"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?