mirror of
https://github.com/leonelquinteros/php-toml.git
synced 2025-01-17 04:18:17 +01:00
Support terminating commas before the closing bracket in arrays
This commit is contained in:
parent
66b7720028
commit
c2f86aea0a
@ -18,7 +18,6 @@ Supports commit: f68d014bfd4a84a64fb5f6a7c1a83a4162415d4b
|
||||
TODO
|
||||
----
|
||||
|
||||
- Support terminating commas before the closing bracket in arrays
|
||||
- Throw exception on extra chars after keygroup definition
|
||||
- Throw exception on mixed data type arrays
|
||||
- Throw exception on key or keygroup overwriting
|
||||
|
@ -307,7 +307,11 @@ class Toml
|
||||
|
||||
if($openBrackets == 0)
|
||||
{
|
||||
$result[] = self::parseValue( trim($buffer) );
|
||||
// Allow terminating commas before the closing bracket
|
||||
if(trim($buffer) != '')
|
||||
{
|
||||
$result[] = self::parseValue( trim($buffer) );
|
||||
}
|
||||
|
||||
// Skip first and las brackets. We're finish.
|
||||
return $result;
|
||||
|
@ -11,7 +11,7 @@ dob = 1979-05-27T07:32:00Z # First class dates? Why not?
|
||||
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002 ]
|
||||
ports = [ 8001, 8001, 8002, ]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
|
||||
@ -38,11 +38,11 @@ key = [
|
||||
],
|
||||
[
|
||||
"10.0.0.1", "Escaped \" quote"
|
||||
]
|
||||
],
|
||||
]
|
||||
|
||||
# Line breaks are OK when inside arrays
|
||||
hosts = [
|
||||
"alpha # Try this hash", # Comment here, after string hash.
|
||||
"omega"
|
||||
"omega",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user