(09-07-2023, 01:53 AM)kenjis Wrote: I cannot reproduce the error.
I see "<a href="http://localhost:8080/index.php/battle/view/4">here</a>".
PHP Code:
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index(): string
{
return model('Foo')->replicateBug();
}
}
PHP Code:
<?php
namespace App\Models;
use CodeIgniter\Model;
class Foo extends Model
{
protected $table = 'foo';
public function replicateBug(): string
{
return anchor('battle/view/4', 'here');
}
}
Note: I checked and I did not extend or replace/customize the URI or Request Service.
Did you try to reproduce it by calling the method from CLI?
I added a debug message and if i browse the app the uri returned is correct:
$currentURI CodeIgniter\HTTP\SiteURI#21 (20)
While if i call the method in the Model from CLI and i type from ms-dos:
Code:
>php public\index.php battle replicate_bug
I have wrong URI:
PHP Code:
CodeIgniter\HTTP\URI#19 (15) (
protected 'uriString' -> null
private 'baseURL' -> null
protected 'segments' -> array (0) []
protected 'scheme' -> string (4) "http"
protected 'user' -> null
protected 'password' -> null
protected 'host' -> null
protected 'port' -> null
protected 'path' -> null
protected 'fragment' -> string (0) ""
protected 'query' -> array (0) []
protected 'defaultPorts' -> array (4) [
'http' => integer 80
'https' => integer 443
'ftp' => integer 21
'sftp' => integer 22
]
protected 'showPassword' -> boolean false
protected 'silent' -> boolean false
protected 'rawQueryString' -> boolean false
)