| @@ 557-569 (lines=13) @@ | ||
| 554 | $elements = []; |
|
| 555 | $i = $j = 0; |
|
| 556 | $in_quotes = false; |
|
| 557 | while ($i < strlen($arr)) { |
|
| 558 | // If current char is a double quote and it's not escaped, then |
|
| 559 | // enter quoted bit |
|
| 560 | $char = substr($arr, $i, 1); |
|
| 561 | if ($char == '"' && ($i == 0 || substr($arr, $i - 1, 1) != '\\')) { |
|
| 562 | $in_quotes = !$in_quotes; |
|
| 563 | } elseif ($char == ',' && !$in_quotes) { |
|
| 564 | // Add text so far to the array |
|
| 565 | $elements[] = substr($arr, $j, $i - $j); |
|
| 566 | $j = $i + 1; |
|
| 567 | } |
|
| 568 | ++$i; |
|
| 569 | } |
|
| 570 | // Add final text to the array |
|
| 571 | $elements[] = substr($arr, $j); |
|
| 572 | ||
| @@ 114-126 (lines=13) @@ | ||
| 111 | $aces = []; |
|
| 112 | $i = $j = 0; |
|
| 113 | $in_quotes = false; |
|
| 114 | while ($i < strlen($acl)) { |
|
| 115 | // If current char is a double quote and it's not escaped, then |
|
| 116 | // enter quoted bit |
|
| 117 | $char = substr($acl, $i, 1); |
|
| 118 | if ($char == '"' && ($i == 0 || substr($acl, $i - 1, 1) != '\\')) { |
|
| 119 | $in_quotes = !$in_quotes; |
|
| 120 | } elseif ($char == ',' && !$in_quotes) { |
|
| 121 | // Add text so far to the array |
|
| 122 | $aces[] = substr($acl, $j, $i - $j); |
|
| 123 | $j = $i + 1; |
|
| 124 | } |
|
| 125 | ++$i; |
|
| 126 | } |
|
| 127 | // Add final text to the array |
|
| 128 | $aces[] = substr($acl, $j); |
|
| 129 | ||