mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 05:58:42 +00:00
Reduce array parsing edge case bugs
This commit is contained in:
parent
051c123b77
commit
a47d784f66
|
|
@ -42,7 +42,7 @@ class ArrayParser
|
||||||
|
|
||||||
foreach ($arr as $key => $val) {
|
foreach ($arr as $key => $val) {
|
||||||
if (is_string($key)) {
|
if (is_string($key)) {
|
||||||
$key = '"' . $key . '"';
|
$key = '\'' . str_replace('\'', '\\\'', $key) . '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stringify .= str_repeat(' ', $depth * 4) . $key . ' => ' . self::parseVariable($val, $depth + 1) . ',' . PHP_EOL;
|
$stringify .= str_repeat(' ', $depth * 4) . $key . ' => ' . self::parseVariable($val, $depth + 1) . ',' . PHP_EOL;
|
||||||
|
|
@ -67,7 +67,7 @@ class ArrayParser
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
return ArrayParser::serializeArray($value, $depth);
|
return ArrayParser::serializeArray($value, $depth);
|
||||||
} elseif (is_string($value)) {
|
} elseif (is_string($value)) {
|
||||||
return '"' . $value . '"';
|
return '\'' . str_replace('\'', '\\\'', $value) . '\'';
|
||||||
} elseif (is_scalar($value)) {
|
} elseif (is_scalar($value)) {
|
||||||
return (string) $value;
|
return (string) $value;
|
||||||
} elseif ($value === null) {
|
} elseif ($value === null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user