Skip to content

Bug: URI::setSegment() accepts the last +2 segment without Exception #7250

@kenjis

Description

@kenjis

CodeIgniter version: develop (4a4f55b) after 4.3.1

This is also reported in #2962

<?php

namespace App\Controllers;

use CodeIgniter\HTTP\URI;

class Home extends BaseController
{
    public function index()
    {
        $uri = new URI('http://example.com/one/two');

        $uri->setSegment(4, 'four');
        var_dump($uri->getSegments());
        echo $uri;
    }
}

The result:

array (size=3)
  0 => string 'one' (length=3)
  1 => string 'two' (length=3)
  2 => string 'four' (length=4)

http://example.com/one/two/four 

Metadata

Metadata

Assignees

Labels

bugVerified issues on the current code behavior or pull requests that will fix them

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions