Skip to content
This repository has been archived by the owner on Feb 15, 2020. It is now read-only.

problem with fortniteleaderboardData #8

Closed
AlbyMangels opened this issue May 9, 2018 · 7 comments
Closed

problem with fortniteleaderboardData #8

AlbyMangels opened this issue May 9, 2018 · 7 comments

Comments

@AlbyMangels
Copy link

I am now using php 7 but am getting this error? Any ideas?

PHP Warning: Division by zero in /var/www/fortnitetest/vendor/tustin/fortnite-php/src/Model/FortniteStats.php on line 72
PHP Fatal error: Uncaught Error: Call to undefined method Fortnite\Leaderboard::getLeaderboardData() in /var/www/fortnitetest/basic2.php:18
Stack trace:
#0 {main}
thrown in /var/www/fortnitetest/basic2.php on line 18

@Fyris
Copy link
Contributor

Fyris commented May 9, 2018

Can you paste the code you're trying to run?

@Tustin
Copy link
Owner

Tustin commented May 9, 2018

@Fyris looks like a problem with the code you added. You're trying to calculate the custom properties (kill/death, win/loss, etc) without doing a check to make sure the divisor in each statement isn't zero. This would be an issue for people who haven't played the game but want to use this library for stat lookup or something. I'll add the checks and commit the change.

@Tustin Tustin closed this as completed in e1a6faf May 9, 2018
@AlbyMangels
Copy link
Author

AlbyMangels commented May 9, 2018

I was using the example leaderboard code that came in the distribution

$auth = Auth::login('epic_email@domain.com','password');
var_dump($auth->leaderboard->getLeaderboardData(Platform::PC, Mode::DUO));

@Fyris
Copy link
Contributor

Fyris commented May 9, 2018

@Tustin Yeah, i was aware of that when he opened the issue but leader boards should not call any methods that gets stats, leader boards only return a list of names. That's why i asked him to paste the code.
His main error says "PHP Fatal error: Uncaught Error: Call to undefined method" not the dividing by zero one, so i assume the fix deployed should only the warning and not the fatal error.

@AlbyMangels Try this one, as @Tustin renamed the method in one of his latest commits

$auth = Auth::login('epic_email@domain.com','password');
var_dump($auth->leaderboard->get(Platform::PC, Mode::DUO));

@AlbyMangels
Copy link
Author

oh ok thanks

@Tustin
Copy link
Owner

Tustin commented May 10, 2018

Oh my bad! I like to use the shorthand names like that because some of the previous ones just seem redundant. Although I am surprised that PHP only throws a warning on a division by zero error.

@AlbyMangels
Copy link
Author

Thanks Fyris and my bad I probably should have dug a bit deeper.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants