"warning" if $element in strlen($element) have null value
Closed this issue · 0 comments
I have some data with 4 column.
For example id, name, phone, address.
This data can be filtered by name or phone with form method get and query sql "like".
First time opened the page there no "warning" log shown.
If I try to filter with name and phone it good as should be.
Maybe the url have some text like this
employee?name=jhon&phone=7878
But if form filter/search just input name without phone, of course I just remember the name for example.
addres bar show like this
employee?name=jhon&phone=
There some input will passing null data from submitting form and show warning on log.
Warning have reference on line 251 in file SortableLink.php
This is the code
return is_array($element) ? $element : strlen($element);
strlen($element) can't count null data if some of filter pass null data.
how about if use this code instead ?
return is_array($element) ? $element : strlen($element ?? '');
so if $element catch null parameter it will go to next value "empy string" and it can allowed in php function strlen() without warning.
or maybe there another way to solve this "warning" condition ?