| @@ 558-570 (lines=13) @@ | ||
| 555 | ||
| 556 | $comps = explode($this->separator, $path); |
|
| 557 | $new_comps = array(); |
|
| 558 | foreach ($comps as $comp) { |
|
| 559 | if (in_array($comp, array('', '.'))) { |
|
| 560 | continue; |
|
| 561 | } |
|
| 562 | ||
| 563 | if (($comp != '..') |
|
| 564 | || (!$initial_slashes && !$new_comps) |
|
| 565 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 566 | array_push($new_comps, $comp); |
|
| 567 | } elseif ($new_comps) { |
|
| 568 | array_pop($new_comps); |
|
| 569 | } |
|
| 570 | } |
|
| 571 | $comps = $new_comps; |
|
| 572 | $path = implode($this->separator, $comps); |
|
| 573 | if ($initial_slashes) { |
|
| @@ 303-315 (lines=13) @@ | ||
| 300 | ||
| 301 | $comps = explode('/', $path); |
|
| 302 | $new_comps = array(); |
|
| 303 | foreach ($comps as $comp) { |
|
| 304 | if (in_array($comp, array('', '.'))) { |
|
| 305 | continue; |
|
| 306 | } |
|
| 307 | ||
| 308 | if (($comp != '..') |
|
| 309 | || (!$initial_slashes && !$new_comps) |
|
| 310 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 311 | array_push($new_comps, $comp); |
|
| 312 | } elseif ($new_comps) { |
|
| 313 | array_pop($new_comps); |
|
| 314 | } |
|
| 315 | } |
|
| 316 | $comps = $new_comps; |
|
| 317 | $path = implode('/', $comps); |
|
| 318 | if ($initial_slashes) { |
|