-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
CI3 and PHP8.1(ctype_digit(): Argument of type int will be interpreted as string in the future) #6285
Comments
Looks to me that the ctype part of that if statement should just be removed. As far as I can see so far none of the other drivers check anything other than that the value isn't empty before using it. |
Removing the check might have unintended consequences so a better approach would be to simply cast the variable as a string which is done pretty much everywhere else in the framework. Change line 98 in the file to read:
|
It's inconsistently checked in each database driver. Most just check if the port is not empty. In this case, it's just to find out if the port number is not empty. If casting to a string, this should also be applied elsewhere such as here and here. |
Correct. Also in DB_driver.php, DB_query_builder.php, Session.php, Form_validation.php and Image_lib.php |
The thing is, in some of these cases the variable is expected to be a string and not an int, for example in the Either way, the simplest fix here is casting. I'll open a PR later and add it to my fork. |
When trying to use PostgreSQL under the given conditions, the following error occurs:
Should I modify the postgre/postgre_driver.php file to resolve this? If it’s acceptable, I can submit a PR.
Also, has anyone resolved the same issue using an override?
I attempted to create a custom class under the application/core directory to override it, but this error still persists.
The text was updated successfully, but these errors were encountered: