CodeIgniter
CodeIgniter copied to clipboard
fix: PHP 8.1 deprecated error in URI::ruri_string()
ltrim(): Passing null to parameter #1 ($string) of type string is deprecated
Steps to Reproduce In a controller:
echo $this->uri->ruri_string();
I'm not sure if this should be the fix or it, or that we should default the property CI_Router::$directory to an empty string (''), as we expect anyway that to be a string.
Of course, this would imply for sure other 2 places to be changed as well, since we check for the NULLness of the property.
instead string(), it should be an isset() like this:
return ltrim(isset(load_class('Router', 'core')->directory), '/').implode('/', $this->rsegments);