Closed alikon closed 1 year ago
Question is what will happen if we apply the fix and run an export and the import the exported file again? Will the import work and apply null values where necessary where we now will have empty strings with the fix?
Whether you print null or an empty string does not make a difference. In both cases, the result will be <field ...></field>
.
We may need to differentiate though as those are different things in e.g. postgres
We may need to differentiate though as those are different things in e.g. postgres
Not in this case - it is about htmlspecialchars()
not liking null as a parameter.
@mbabker or @nibra what is the way forward here, I see more null
issues and its probably only going to get worse. I already from @mbabker response on the registry issue can see we need to go over all of the framework to solve it. Almost seems like a RECTOR task, to at least to get a dry run report of the scale of the task.
Anyway any more feedback here will help, thanks!
In this case, the patch is ok and doing it's job.
No, it's not. As George already pointed out, there is a huge difference between a database column storing a null value versus an empty string, and this patch makes it impossible to distinguish the two in an exported dataset.
Although you're right that NULL should be handled differently, does this patch not change the behaviour. The exporter has always delivered an empty string for NULL values.
I've created an alternative PR which properly handles NULL values: #286
closing in favour of #264 better to have 1 pr
Summary of Changes
used null coalescing operator
Testing Instructions
with Error Reporting setted to Maximum run
php cli/joomla.php database:export --folder=tmp/
you got a lot of
PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /shared/httpd/test/zzzz/libraries/vendor/joomla/database/src/DatabaseExporter.php on line 305