yaroslavche / phptdlib

PHP Extension for tdlib/td written with PHP-CPP
https://yaroslavche.github.io/phptdlib/
MIT License
104 stars 26 forks source link

Valid api_id must be provided. Can be obtained at https://my.telegram.org #104

Closed AlexGnatko closed 1 year ago

AlexGnatko commented 2 years ago

Hi!

I've encountered the problem with the newest version of phptdlib not being able to ->setParameter(TDApi\TDLibParameters::API_ID, $api_id). Unfortunately, Yaroslav himself doesn't yet have a solution to this problem. I suspect there's some change in data types for API_IDs in the newest versions of https://github.com/tdlib/td/, which is a sub-module of this project.

But, I've managed to find a temporary solution to the problem. All you have to do is make sure that you're using a much older version of the td submodule, that still worked without issues back in May 2022. I chose version 1.8.3 and made a fork:

https://github.com/AlexGnatko/td/

To apply the fix, go to the .gitmodules file and change the td url to https://github.com/AlexGnatko/td.git.

Then run the following commands:

git submodule sync --recursive
cd modules/td

git fetch
git checkout origin/master
git branch master -f
git checkout master

And then follow the build steps listed in the readme file.

For me, it fixed the problem, and even though I don't have a recent version of TDLib compiled into phptdlib, I can at least use most of the Telegram functions in my PHP.

I hope this helps anyone who bumps into a similar problem.

yaroslavche commented 2 years ago

The same problem occurs with FFI calls without extension. I don't know why =) I've tried 1.8.8

FASKHETDINOV commented 1 year ago

@AlexGnatko @yaroslavche

Starting from TDLib v1.8.6+ setTdlibParameters values must be inlined and i can see in your JSON https://github.com/tdlib/td/issues/2211

Solution https://github.com/yaroslavche/phptdlib/commit/770b16fb91e903ace76381cadfada0a3ecec310b

yaroslavche commented 1 year ago

@FASKHETDINOV Hi, thanks for the info and fix. CI build didn't pass, since it requires update fot tdlib to latest 1.8.10. Later I'll push commit into your PR and will merge. Or you can update it, need to do two things: run command in the repository root directory

git submodule foreach git pull origin master

and change version in CMakeLists.txt to 1.8.10 here Thanks.

yaroslavche commented 1 year ago

@AlexGnatko since the problem is found, I'll close this issue. Can confirm, that now it works for me (but I've checked calls via FFI, not with this extension).