mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-18 12:48:41 +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) {
|
||||
if (is_string($key)) {
|
||||
$key = '"' . $key . '"';
|
||||
$key = '\'' . str_replace('\'', '\\\'', $key) . '\'';
|
||||
}
|
||||
|
||||
$stringify .= str_repeat(' ', $depth * 4) . $key . ' => ' . self::parseVariable($val, $depth + 1) . ',' . PHP_EOL;
|
||||
|
|
@ -67,7 +67,7 @@ class ArrayParser
|
|||
if (is_array($value)) {
|
||||
return ArrayParser::serializeArray($value, $depth);
|
||||
} elseif (is_string($value)) {
|
||||
return '"' . $value . '"';
|
||||
return '\'' . str_replace('\'', '\\\'', $value) . '\'';
|
||||
} elseif (is_scalar($value)) {
|
||||
return (string) $value;
|
||||
} elseif ($value === null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user