Bug #16799
closedxml2array crashes sometimes since php 5.2
0%
Description
xml2array sometimes uses strcspn with an empty first argument. This may crash apache/php, certainly since php 5.2.
The solution is to test for empty strings first (see included one-liner patch).
One could argue that this is a php 5.2 problem, but I think this is also a typo3 problem since the core is using an undocumented php feature here. In the strcspn documentation it is not mentioned how the function responds to an empty first argument. It may even depend on the underlying C-library. So I am in favor of removing this bad programming style from typo3.
(issue imported from #M4678)
Files
Updated by Luc Van Eycken almost 18 years ago
Silly me. Of course it is array2xml and not xml2array!
Updated by Martin Kutschker almost 18 years ago
Patch works.
Though I would try to avoid a double strlen.
Updated by Dmitry Dulepov almost 18 years ago
I am in favor of removing this bad programming style from typo3.
Hm. I am in favor of removing bad accusations from all BT entries.
Updated by Luc Van Eycken almost 18 years ago
Please forgive my bad wording, I didn't want to offend anybody. On the contrary, I am impressed by the work of the Typo3 core people. So if anybody thinks this is an accusation instead of a plea to incorporate this patch, I apologize and I agree with Dmitry that these remarks should be removed from the BT.
Updated by Marc Wöhlken almost 18 years ago
I have tested the above patch with several TYPO3 installations and it does work for all of them.
Add this patch to SVN
+1