Commit d391f709 authored by Christian Kuhn's avatar Christian Kuhn Committed by Susanne Moog
Browse files

[BUGFIX] Broken quoting in arrayExport

Tick (') must be quoted to \'

Change-Id: I006173f0d5e1e17de1ff8801c71c6167fd96087d
Resolves: #39346
Releases: 6.0
Reviewed-on: http://review.typo3.org/13225
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
parent a5b88033
......@@ -290,7 +290,11 @@ class t3lib_utility_Array {
$lines .= $value ? 'TRUE' : 'FALSE';
$lines .= ',' . LF;
} elseif (is_string($value)) {
$lines .= '\'' . str_replace('\\', '\\\\', $value) . '\'' . ',' . LF;
// Quote \ to \\
$stringContent = str_replace('\\', '\\\\', $value);
// Quote ' to \'
$stringContent = str_replace('\'', '\\\'', $stringContent);
$lines .= '\'' . $stringContent . '\'' . ',' . LF;
} else {
throw new RuntimeException(
'Objects are not supported',
......
......@@ -33,9 +33,9 @@
*/
class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
#######################
# Tests concerning filterByValueRecursive
#######################
///////////////////////
// Tests concerning filterByValueRecursive
///////////////////////
/**
* Data provider for filterByValueRecursiveCorrectlyFiltersArray
......@@ -189,9 +189,9 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
$this->assertEquals(array(), t3lib_utility_Array::filterByValueRecursive(new stdClass(), array(new stdClass())));
}
#######################
# Tests concerning isValidPath
#######################
///////////////////////
// Tests concerning isValidPath
///////////////////////
/**
* Mock the class under test, isValidPath() (method under test), calls
......@@ -228,9 +228,9 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
$this->assertFalse($className::isValidPath(array('foo'), 'foo'));
}
#######################
# Tests concerning getValueByPath
#######################
///////////////////////
// Tests concerning getValueByPath
///////////////////////
/**
* @test
......@@ -422,9 +422,9 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
$this->assertEquals($expected, t3lib_utility_Array::getValueByPath($input, $searchPath, $delimeter));
}
#######################
# Tests concerning setValueByPath
#######################
///////////////////////
// Tests concerning setValueByPath
///////////////////////
/**
* @test
......@@ -625,9 +625,9 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
);
}
#######################
# Tests concerning sortByKeyRecursive
#######################
///////////////////////
// Tests concerning sortByKeyRecursive
///////////////////////
/**
* @test
......@@ -656,9 +656,9 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
$this->assertSame($expectedResult, t3lib_utility_Array::sortByKeyRecursive($unsortedArray));
}
#######################
# Tests concerning arrayExport
#######################
///////////////////////
// Tests concerning arrayExport
///////////////////////
/**
* @test
......@@ -681,7 +681,7 @@ class t3lib_utility_ArrayTest extends tx_phpunit_testcase {
TAB . '\'foo\' => array(' . LF .
TAB . TAB . '\'bar\' => 42,' . LF .
TAB . TAB . '\'bar2\' => array(' . LF .
TAB . TAB . TAB . '\'baz\' => \'val\'ue\',' . LF .
TAB . TAB . TAB . '\'baz\' => \'val\\\'ue\',' . LF .
TAB . TAB . TAB . '\'baz2\' => TRUE,' . LF .
TAB . TAB . TAB . '\'baz3\' => FALSE,' . LF .
TAB . TAB . TAB . '\'baz4\' => array(),' . LF .
......
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