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

valid_ip removed $data which was causing exception #2540

Merged
merged 4 commits into from
Feb 17, 2020

Conversation

nowackipawel
Copy link
Contributor

No description provided.

@MGatner
Copy link
Member

MGatner commented Feb 10, 2020

That data parameter is odd and appears that it should be removed, as you noted. Please also remove its reference from the inline docs (@param).

What is the inet_ntop? You should explain additions and ideally add them in a separate PR.

Removed $data in docs.
Added check if $ip is binary string to do not check inet_ntop on human readable strings.
@nowackipawel
Copy link
Contributor Author

nowackipawel commented Feb 11, 2020

@MGatner inet_ntop and pton are converting the IPv4 or v6 string to its binary/human readable form.
I also think about extending Entity as well to store it bydefault like this... and this extending will be preety easy:
in castAs:
``

        case 'ip':
            $value = inet_ntop($value);
            break;

in __set

        if($castTo === 'ip')
        {
            $value = inet_pton($value);
        }

``
in fact I am using this in my extended entity class to do not use setters every time when I need to stroe IP in that efficient way.

@MGatner
Copy link
Member

MGatner commented Feb 17, 2020

Since the tests are all passing this doesn't seem to have affected the outcomes, while potentially improving the service. It looks good to me, will merge - thanks!

Re: Entity auto-cast, I like the idea. Since casts are only used when a developer requests them I think it is a fine addition. If you want to add it please start a new PR and be sure to update the User Guide and have tests with the new cast.

@MGatner MGatner merged commit 005cef0 into codeigniter4:develop Feb 17, 2020
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.

2 participants