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

Bug: Cannot send message because room id is converted to number. #9

Open
bahuma20 opened this issue Jun 24, 2024 · 0 comments · May be fixed by #10
Open

Bug: Cannot send message because room id is converted to number. #9

bahuma20 opened this issue Jun 24, 2024 · 0 comments · May be fixed by #10

Comments

@bahuma20
Copy link

Detailed description

When trying to send a message, using the MatrixHttpApi directly like this...

$matrix = new MatrixHttpApi("https://matrix.org", "mySecretAccessToken");
$matrix->sendMessage("!aBcDeFgHiJkLmNoP:matrix.org", "TEST");

... i get this Exception:

MatrixPhp\Exceptions\MatrixRequestException: {"errcode":"M_FORBIDDEN","error":"User @myUsername:matrix.org not in room 0"} in MatrixPhp\MatrixHttpApi->send() (Line 971 in ../vendor/meet-kinksters/php-matrix-sdk/src/MatrixHttpApi.php).

Context

I think i already found the reason for this:

This bug was introduced in this commit: a2f2ede#diff-38b93873fb3c16b88d76ea19944d82e9690d16322838a0f3fbd18051a3aae87dR353

In the sprintf function, the specifier for the room id was changed from %s (string) to %u (unsigned decimal number).

This is not fitting for the room id which is in format !aBcDeFgHiJkLmNoP:matrix.org.

Possible implementation

Change back from %u to %s

bahuma20 added a commit to bahuma20/php-matrix-sdk that referenced this issue Jun 24, 2024
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

Successfully merging a pull request may close this issue.

1 participant