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 warning calling sizeof on string in checkout #6

Open
wb-lime opened this issue Jul 10, 2019 · 0 comments
Open

PHP warning calling sizeof on string in checkout #6

wb-lime opened this issue Jul 10, 2019 · 0 comments

Comments

@wb-lime
Copy link

wb-lime commented Jul 10, 2019

Warning: sizeof(): Parameter must be an array or an object that implements Countable in lib/PayPal/Common/PayPalModel.php on line 163

Warning occurs when placing an order

if ($v instanceof PayPalModel) {
    $ret[$k] = $v->toArray();
} else if (sizeof($v) <= 0 && is_array($v)) {
    $ret[$k] = array();
} else if (is_array($v)) {
    $ret[$k] = $this->_convertToArray($v);
} else {
    $ret[$k] = $v;
}

should be:

if ($v instanceof PayPalModel) {
    $ret[$k] = $v->toArray();
} else if (is_array($v) && sizeof($v) <= 0) {
    $ret[$k] = array();
} else if (is_array($v)) {
    $ret[$k] = $this->_convertToArray($v);
} else {
    $ret[$k] = $v;
}

is_array should be checked before calling sizeof

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

1 participant