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