Project

General

Profile

Actions

Bug #52060

closed

FlexFormService::convertFlexFormContentToArray(): PHP Warnings when XML is invalid

Added by Benjamin Pick about 11 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2013-09-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When passing an invalid XML, the method FlexFormService::convertFlexFormContentToArray() throws the following PHP warnings:

<blockquote>
PHP Warning: Invalid argument supplied for foreach() in /typo3/sysext/extbase/Classes/Service/FlexFormService.php line 51
PHP Warning: array_values() expects parameter 1 to be array, string given in /typo3/sysext/extbase/Classes/Service/FlexFormService.php line 51
</blockquote>

Instead, it should log the original XML Error and return an empty array(). (This would have helped debugging issues like #51907).

<b>Technical Details</b>

\TYPO3\CMS\Core\Utility\GeneralUtility::xml2array() returns a string when an error occurs (e.g. "Line 10: Invalid character ..."). So $flexFormArray['data'] is interpreted as string access (first character, 'data' is coerced into 0). $flexFormArray then is assigned 'L', which of course isn't an array anymore.

This was discovered in 6.1 but should still be present in 6.2 HEAD.


Files

fix_52060.patch (1.11 KB) fix_52060.patch (replace placeholder for throwing typo3 notices!) Benjamin Pick, 2013-09-17 10:16
Actions #1

Updated by Benjamin Pick about 11 years ago

Tentative fix. A unit test would be good.

Actions #2

Updated by Mathias Schreiber almost 10 years ago

  • Target version set to 7.4 (Backend)
Actions #3

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #4

Updated by Benni Mack about 9 years ago

  • Sprint Focus set to Stabilization Sprint
Actions #5

Updated by Benni Mack about 9 years ago

  • Target version changed from 7.5 to 7 LTS
  • Sprint Focus deleted (Stabilization Sprint)
Actions #6

Updated by Marcin Krzyzanowski about 9 years ago

I've done some unit tests with bad xml input structure. No warnings at all.
Is there a chance to see those warnings any other way?

I also wanted to add that I ran above tests with php 5.2.27

Actions #7

Updated by Mathias Schreiber about 9 years ago

  • Status changed from New to Closed

can't reproduce on master

Actions

Also available in: Atom PDF