| @@ 660-672 (lines=13) @@ | ||
| 657 | ||
| 658 | $comps = explode($this->separator, $path); |
|
| 659 | $new_comps = []; |
|
| 660 | foreach ($comps as $comp) { |
|
| 661 | if (in_array($comp, ['', '.'])) { |
|
| 662 | continue; |
|
| 663 | } |
|
| 664 | ||
| 665 | if (($comp != '..') |
|
| 666 | || (! $initial_slashes && ! $new_comps) |
|
| 667 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 668 | array_push($new_comps, $comp); |
|
| 669 | } elseif ($new_comps) { |
|
| 670 | array_pop($new_comps); |
|
| 671 | } |
|
| 672 | } |
|
| 673 | $comps = $new_comps; |
|
| 674 | $path = implode($this->separator, $comps); |
|
| 675 | if ($initial_slashes) { |
|
| @@ 357-369 (lines=13) @@ | ||
| 354 | ||
| 355 | $comps = explode('/', $path); |
|
| 356 | $new_comps = []; |
|
| 357 | foreach ($comps as $comp) { |
|
| 358 | if (in_array($comp, ['', '.'])) { |
|
| 359 | continue; |
|
| 360 | } |
|
| 361 | ||
| 362 | if (($comp != '..') |
|
| 363 | || (! $initial_slashes && ! $new_comps) |
|
| 364 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 365 | array_push($new_comps, $comp); |
|
| 366 | } elseif ($new_comps) { |
|
| 367 | array_pop($new_comps); |
|
| 368 | } |
|
| 369 | } |
|
| 370 | $comps = $new_comps; |
|
| 371 | $path = implode('/', $comps); |
|
| 372 | if ($initial_slashes) { |
|