First I must say that there is a lack of dicomentation explaing what the $properties input variable is: I just took a guess that it was the schema model fields list.
Anyway, there is a serious bug in your code, a complete lack of understanding about the behaviour of certain php functions and consequently the misuse of them: viz:
You are using parse_date to test if a value is a date. NOT what it is intended for: all sorts of non-dates can be parsed into a date when they are not. It is the same as Excel converting phone numbers into dates: completely stupid.
In our case the STRING '012487377/1' is evaluated as a DATE and the code fails
Now I will be fixing the code locally by elliminating that set of test all together. I will specify the data type in the properties array since I designed the grid and I know what the data types are. I would expect that this is the case for 99.9% of developers using your code. Please fix the code at your end so that this does not trip other people up.
Anyway, there is a serious bug in your code, a complete lack of understanding about the behaviour of certain php functions and consequently the misuse of them: viz:
// line 277
if (isset($properties[$field])) {
$type = $properties[$field]['type'];
} else if ($this->isDate($filter->value)) {
$type = "date";
} else if (array_key_exists($filter->operator, $this->operators) && !$this->isString($filter->value)) {
$type = "number";
}
private function isDate($value)
{
$result = date_parse($value);
return $result["error_count"] < 1 && checkdate($result['month'], $result['day'], $result['year']);
}
You are using parse_date to test if a value is a date. NOT what it is intended for: all sorts of non-dates can be parsed into a date when they are not. It is the same as Excel converting phone numbers into dates: completely stupid.
In our case the STRING '012487377/1' is evaluated as a DATE and the code fails
ContextErrorException: Notice: Undefined index: startswith in C:\Development\dlg\src\TLF\PortalBundle\Services\DataSourceResultService.php line 294<
br
>
Now I will be fixing the code locally by elliminating that set of test all together. I will specify the data type in the properties array since I designed the grid and I know what the data types are. I would expect that this is the case for 99.9% of developers using your code. Please fix the code at your end so that this does not trip other people up.