| @@ 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) { |
|
| @@ 282-294 (lines=13) @@ | ||
| 279 | ||
| 280 | $comps = explode('/', $path); |
|
| 281 | $new_comps = array(); |
|
| 282 | foreach ($comps as $comp) { |
|
| 283 | if (in_array($comp, array('', '.'))) { |
|
| 284 | continue; |
|
| 285 | } |
|
| 286 | ||
| 287 | if (($comp != '..') |
|
| 288 | || (!$initial_slashes && !$new_comps) |
|
| 289 | || ($new_comps && (end($new_comps) == '..'))) { |
|
| 290 | array_push($new_comps, $comp); |
|
| 291 | } elseif ($new_comps) { |
|
| 292 | array_pop($new_comps); |
|
| 293 | } |
|
| 294 | } |
|
| 295 | $comps = $new_comps; |
|
| 296 | $path = implode('/', $comps); |
|
| 297 | if ($initial_slashes) { |
|