Commit 12025478 authored by Markus Sommer's avatar Markus Sommer Committed by Benni Mack
Browse files

[TASK] Mark array2xml_cs() as deprecated, use array2xml() instead

Resolves: #75371
Releases: master
Change-Id: Ic11e0dd61ba93056db41e36478ad52a1c855aa1f
Reviewed-on: https://review.typo3.org/47490


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 2fea0a6d
......@@ -279,7 +279,7 @@ class TableController extends AbstractWizardController
// Convert to string (either line based or XML):
if ($this->xmlStorage) {
// Convert the input array to XML:
$bodyText = GeneralUtility::array2xml_cs($this->TABLECFG['c'], 'T3TableWizard');
$bodyText = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . LF . GeneralUtility::array2xml($this->TABLECFG['c'], '', 0, 'T3TableWizard');
// Setting cfgArr directly from the input:
$configuration = $this->TABLECFG['c'];
} else {
......
......@@ -1619,9 +1619,11 @@ class GeneralUtility
* @param string $charset Forced charset to prologue
* @return string An XML string made from the input content in the array.
* @see xml2array(),array2xml()
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9.
*/
public static function array2xml_cs(array $array, $docTag = 'phparray', array $options = array(), $charset = '')
{
static::logDeprecatedFunction();
// Set default charset unless explicitly specified
$charset = $charset ?: 'utf-8';
// Return XML:
......@@ -1629,8 +1631,6 @@ class GeneralUtility
}
/**
* Deprecated to call directly (unless you are aware of using XML prologues)! Use "array2xml_cs" instead (which adds an XML-prologue)
*
* Converts a PHP array into an XML string.
* The XML output is optimized for readability since associative keys are used as tag names.
* This also means that only alphanumeric characters are allowed in the tag names AND only keys NOT starting with numbers (so watch your usage of keys!). However there are options you can set to avoid this problem.
......
==================================
Deprecation: #75371 - array2xml_cs
==================================
Description
===========
The method :php:`GeneralUtility::array2xml_cs()` has been marked as deprecated.
Impact
======
Using the method :php:`GeneralUtility::array2xml_cs()` will trigger a deprecation log entry.
Affected Installations
======================
All installations with third party extensions using this method are affected.
Migration
=========
Use :php:`GeneralUtility::array2xml()` instead. The XML declaration must be written manually.
Example code:
.. code-block:: php
// Deprecated
$bodyText = GeneralUtility::array2xml_cs($array, 'phparray');
// Migrated
$bodyText = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . LF . GeneralUtility::array2xml($array, '', 0, 'phparray');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment