FaaPz/PDO

Warning: sizeof() / setPlaceholders

Closed this issue ยท 3 comments

Hi,

i want to use slilm/pdo lib on newer PHP version (in my case 7.2), and it throws and warning due to use of sizeof function with plain variable (not array) in StatementContainer::setPlaceholders.

Solution could be quite simple, as sizeof is needed only for array type in there.

Can you fix it in library? Or if you prefer, i could suggest fix or other help.

It works ok at version 7.0, is looks like sizeof doesn't throw a warning.

Thank you

related: https://wiki.php.net/rfc/counting_non_countables

$this->placeholders[] = $this->setPlaceholder('?', is_null($value) ? 1 : (is_Array($value) ? sizeof($value) : 1));

FaaPz commented

Thanks @nixoncode! I've implemented your small fix in v1.11.0 (a84ac97). Couldn't use your PR, because of a branch name change I pushed to early. ๐Ÿ˜