A field with value NULL returns an incorrect data-result in EntryManager::__buildEntries()
A bug in 2.2, submitted by kanduvisla on 22 April 2011
Announcement
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
Browse
Closed#618: A field with value NULL returns an incorrect data-result in EntryManager::__buildEntries()
I also experienced this while working on Date and Time. This should be considered as bug in my eyes.
What does is_null($data[0])
return?
This won't make it into 2.2.1 as it may potentially break current extensions that are not expecting null values to return (if this indeed is a bug).
Maybe I can add a few things:
Think of the Date and Time field which stores a start and an end date. Often, the user doesn't set an end date so it would make sense to store NULL in the database. Now think of three dates where the second only contains a start and no end: in this case Symphony won't return all three entries in the $data array but will break after the first NULL value. So it's not possible to fetch all dates.
Can a set of reproducible steps be given to show this bug?
I've tried to replicate with DateTime (2.0RC2), but the end
column is filled with a date, and is not set to null
.
I'm still curious as to the answer to my first question, what does is_null($data[0])
return? It seems very odd to see Array(0=>)
because you can't set an index in an array without giving is a value of at least something
I've tried to replicate with DateTime (2.0RC2)
Date and Time is no longer using null
due to this bug. If you replace this line with $result['end'][] = NULL;
and allow NULL
values in your database you should be able to replicate the issue described in this thread.
So if the Date and Time field stored the following values, the last one would not be returned:
start: 2011-05-01 | end: 2011-05-20 start: 2011-05-22 | end: NULL start: 2011-06-01 | end: 2011-06-30
Fixed in this commit. isset
treats null as false, so an additional check has been introduced to allow fields to store NULL
.
This issue is closed.
Not sure if it's a bug or code conventions, but here is what I experienced: I created an extension (a new field) which could store more values for a single entry (just like a selectbox with multiple options checked).
But my database fields had a default value of
NULL
, and when these fields did not have any value in them, the$data
for this field returned from this function did not contain the proper values. Instead it contains:Now I'm not sure if this should be considered a bug or it has something to do with code conventions for extensions, but it took me a while to figure out what was wrong.
I think the code in lines 445-457 from
class.entrymanager.php
are responsible for this.