Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PHP 8.1 deprecated error in URI::ruri_string() #6117

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kenjis
Copy link
Contributor

@kenjis kenjis commented Mar 17, 2022

ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

Steps to Reproduce
In a controller:

echo $this->uri->ruri_string();

ltrim(): Passing null to parameter bcit-ci#1 ($string) of type string is deprecated
@gxgpet
Copy link
Contributor

gxgpet commented Mar 27, 2022

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.

@slimdestro
Copy link

slimdestro commented Nov 10, 2023

instead string(), it should be an isset() like this:
return ltrim(isset(load_class('Router', 'core')->directory), '/').implode('/', $this->rsegments);

mckaygerhard added a commit to venenux/codeigniterpower that referenced this pull request Feb 6, 2024
* it coplements prevous commit and related to
  commit ad1a307
  is not the proper way but compatible with
  bcit-ci/CodeIgniter#6117
  and solves
  bcit-ci/CodeIgniter#6120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants