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

Attempt to read property "body" on bool #11

Open
sorokaty opened this issue Oct 30, 2022 · 3 comments
Open

Attempt to read property "body" on bool #11

sorokaty opened this issue Oct 30, 2022 · 3 comments

Comments

@sorokaty
Copy link

Hi Alexandr, i send test message, but i get an error

Attempt to read property "body" on bool

at vendor/alexandr-mironov/php-smpp/src/Client.php:511
507▕ }
508▕ }
509▕
510▕ $response = $this->sendCommand(SMPP::SUBMIT_SM, $pdu);
➜ 511▕ $body = unpack("a*msgid", $response->body);
512▕ return $body['msgid'];
513▕ }
514▕
515▕ /**

@braisdesousa
Copy link

Hi @sorokaty what PHP Version are yo running?

@braisdesousa
Copy link

If you are running PHP >= 8 the problem is on the Socket.php File, if you need a quick fix just replace

if (!is_resource($this->socket)) return false;
With
if (!($this->socket instanceof \Socket))return false;

  • In PHP 8.0 and later, all functions from Sockets extension return/accept objects of type \Socket and \AddressInfo class instead of resource of type Socket and AddressInfo.

@alexandr-mironov
Copy link
Owner

Hello!
Sorry for not replying for so long.
If your problems based on PHP version as @braisdesousa says above, then you should use actual version php8-smpp
in other cases i need more details to can reproduce this issue,
but it seems like problem in not opened socket connection, try with debug mode to get more details

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

3 participants