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

Bug: Third Flags needs default #4411

Closed
John-Betong opened this issue Mar 11, 2021 · 1 comment
Closed

Bug: Third Flags needs default #4411

John-Betong opened this issue Mar 11, 2021 · 1 comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@John-Betong
Copy link

Info
I have been trying for over a week to trace a new site's "Network connection Error" from going down overnight. No errors in logs so added "strict_types=1" to all PHP app and system PHP files, also set .env -> CI_ENVIRONMENT = development and eventually managed to get some errors reported.

Describe the bug
incorrect type being passed.

CodeIgniter 4 version
CI_VERSION 4.1.1

Affected module(s)
File: ./system/Validation/FormatRules.php
[code]
public function valid_ip(string $ip = null, string $which = null): bool
{
if (empty($ip))
{
return false;
}
switch (strtolower((string) $which))
{
case 'ipv4':
$which = FILTER_FLAG_IPV4;
break;
case 'ipv6':
$which = FILTER_FLAG_IPV6;
break;
default:
# PROBLEM 2021-03-06 - forced (int)
$which = (int) null;
break;
}

	return (bool) filter_var($ip, FILTER_VALIDATE_IP, $which) || (! ctype_print($ip) && (bool) filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $which));
}

[/code]

Expected behavior, and steps to reproduce if appropriate
I did not expect the web page to crash :(

Context

OS: [Ubuntu 20.04.1]
Web server [Apache 2]
PHP version [8.0.3]

@John-Betong John-Betong added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 11, 2021
@MGatner MGatner changed the title Bug: Bug: Third Flags needs default Mar 11, 2021
@MGatner
Copy link
Member

MGatner commented Mar 11, 2021

Since this is essentially the same issue I am closing this and consolidating the other PRs.

@MGatner MGatner closed this as completed Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants