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

[Bug] Empty list (array) is converted to object #13

Open
zluiten opened this issue Apr 29, 2016 · 1 comment
Open

[Bug] Empty list (array) is converted to object #13

zluiten opened this issue Apr 29, 2016 · 1 comment
Labels
Future Will be taken up for development in the next 3 months

Comments

@zluiten
Copy link

zluiten commented Apr 29, 2016

When a property of a Model is supposed to be a list of some subtype (for example taxes of the InvoiceEstimate), but the ChargeBee returns 0 items in the list, the list is not becoming an empty array, but an (empty) instance of the list type.

It looks like that this can be fixed by isHash function (inside ChargeBee_Model) returning false not only when not being an array, but also when the array is empy.

    private function isHash($array)
    {
        if (!is_array($array) || count($array) === 0)
            return false;
        foreach (array_keys($array) as $k) {
            if (is_numeric($k))
                return false;
            }
        return true;
    }
@peter279k
Copy link

Any one concern this PR?

@cb-rakesh cb-rakesh added the Future Will be taken up for development in the next 3 months label Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Future Will be taken up for development in the next 3 months
Projects
None yet
Development

No branches or pull requests

3 participants