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

Mapper->load() fails if the first parameter is an empty array #1257

Closed
paolobertani opened this issue Jun 24, 2022 · 2 comments
Closed

Mapper->load() fails if the first parameter is an empty array #1257

paolobertani opened this issue Jun 24, 2022 · 2 comments

Comments

@paolobertani
Copy link

Mapper->load() calls stringyfy() passing the filter

on line 225 of db/sql/mapper.php

if (is_array($filter) )

doesn't check if $filter is an empty array. In that case the function produces an error trying to access $filter[0]

I suggest to change with

if (is_array($filter) && count($filter)>0)

@pauljherring
Copy link

You should pass null, if the filter is otherwise empty.

Because that's what's used if you specify nothing at all in the parens.

@paolobertani
Copy link
Author

paolobertani commented Jun 24, 2022

yes, off course

I just wonder if it's enought clear from the documentation

I think an empty array should be allowed as well to specify that no filter have to be applied, just as passing null or an empty string.

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

2 participants