magnussolution / magnusbilling7

MagnusBilling is a fast, secure, efficient, high availability, VOIP Billing.
https://www.magnusbilling.org
GNU Lesser General Public License v3.0
182 stars 106 forks source link

Use of count() on objects that do not implement Countable breaks feature in Moip #680

Open vivaEspanaDelMu opened 2 months ago

vivaEspanaDelMu commented 2 months ago

Describe the bug The use of count() on the returned object from find() in the User model throws a fatal error since the object does not implement Countable. Find will only return a single object or NULL, neither of which implement Countable. Not sure if this is because of other changes or an upgrade to later versions of PHP, but it used to work and I only noticed recently that it started failing.

I have made and tested a fix, and created a PR for it. There are probably other places where this is failing and I intend to make more PRs later as I encounter them.

https://github.com/magnussolution/magnusbilling7/pull/679

Expected behavior Page should not return "count()" error and stop. It should call releaseUserCredit without crashing.