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

PHP Fatal error: Uncaught exception #8

Closed
skorotkiewicz opened this issue Jul 18, 2015 · 1 comment
Closed

PHP Fatal error: Uncaught exception #8

skorotkiewicz opened this issue Jul 18, 2015 · 1 comment

Comments

@skorotkiewicz
Copy link

aue@aaak:~/telegram-bot-sdk# php stest.php 
PHP Fatal error:  Uncaught exception 'Irazasyed\Telegram\Exceptions\TelegramUndefinedPropertyException' in /aue/telegram-bot-sdk/src/Objects/BaseObject.php:144
Stack trace:
#0 /aue/telegram-bot-sdk/stest.php(13): Irazasyed\Telegram\Objects\BaseObject->__call('getLastName', Array)
#1 /aue/telegram-bot-sdk/stest.php(13): Irazasyed\Telegram\Objects\User->getLastName()
#2 {main}
  thrown in /aue/telegram-bot-sdk/src/Objects/BaseObject.php on line 144
aue@aaak:~/telegram-bot-sdk# cat stest.php 
<?php

$loader = require __DIR__.'/vendor/autoload.php';

use Irazasyed\Telegram\Telegram;

$telegram = new Telegram('XX:XX');

$response = $telegram->getMe();

$botId = $response->getId();
$firstName = $response->getFirstName();
$lastName = $response->getLastName();
$username = $response->getUsername();

echo $botId . ' ' . $firstName . ' ' . $lastName . ' ' . $username;
@irazasyed
Copy link
Owner

Actually, Bots don't have last name. So you need not use getLastName(). I've removed from the README example as well.

LastName will be available for the actual user though. So you can remove that and it'll work fine.

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

2 participants