Open neekfenwick opened 3 years ago
Hey, thanks for your input! You are right, the code was written with PHP version 5.6 being the newest one if I call correctly. At this time using an array index which has not been defined was not throwing a notice. But we can definitively fix this. The isset approach is correct and you are right. The number used is indeed more of an object key than an array index. So yes, changing it to a string representative would be good.
Please feel free to provide an PR and I will merge it as soon as possible.
Hi there, I'm running DXFighter for some very simple requirements and notice that it produces a lot of Notice level logging such as on this line:
Here the '39' is specified in the spec and is not really intended to be used as a numerical index into the array, and if it doesn't exist in the array it results in a Notice. Older PHP perhaps didn't complain about this but, at least, PHP 7 does. It seems the correct code would be:
When running from the command line I'm finding all the Notice output annoying and would rather fix it than adjust my log levels. Would you accept a PR that tries to replace all these occurences?
I'm also not sure if the '39' should be quoted, as we're not so much referring to 39 as a number, but as a 'code' as defined in the spec. See https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf under "Group Code Value Types". It seems that leaving them as integers in the PHP code, and thus a sparsely allocated array, works fine, so I guess quoting the code such as
$data['39']
isn't necessary.