Problem/Motivation
We have some "beautiful" JSON converted from XML, yay IBM!
"@columnnumber": "2",
"@name": "WriteLog",
"textlist": {
"text": [
{
"0": "2008.OCT.28 12:54:39 CET # Admin/EMI"
},
{
"0": "2009.MAY.25 04:56:16 CEDT # Admin/EMI"
},
This would be a piece of cake with Iterator but the necessary source: 0 triggers the Get feature where you can insert the current value into the Get array.
Proposed resolution
Change empty to === ''. API break, baby! Yay! I wonder how many even used this feature (I know we discussed on IRC and it was needed) but among those who have used it I would bet practically anything it looks like this:
source:
- foo
-
- bar
so empty string should be fine.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
chx commentedComment #3
benjy commentedSimple unit test.
Comment #4
chx commentedReuploading #3 but also with a -fail patch to see it failing.
Comment #6
quietone commentedYes, integers need to be allowed. But now getSourceProperty() or getDestinationProperty() can be called with other empty values, like NULL or false. Is that desirable?
Comment #7
benjy commentedThat's a valid point, maybe we should have
if (empty($property) && $property !== 0)Comment #8
benjy commentedOK, updated the logic and added two more tests for the NULL/FALSE cases. Also flipped the conditions which makes it more readable.
Comment #9
quietone commentedThx benjy. It is easier to read. Looks good to me so RTBC.
Comment #10
alexpottCommitted 6fd640f and pushed to 8.0.x, 8.1.x and 8.2.x. Thanks!
I've committed this to 8.0.x because whilst this is an API change this is a very minor API change to an experimental and making this work the same in all branches is desirable.