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

Can get a 'hidden' validation warning trying to clone if exp_channel_titles missing ip #3998

Closed
robinsowell opened this issue Jan 12, 2024 · 2 comments · Fixed by #4001
Closed

Comments

@robinsowell
Copy link
Contributor

robinsowell commented Jan 12, 2024

User was getting a weird issue trying to clone some entries- it would do a validation error message, but nothing was highlighted as invalid. After digging, it was objecting to a missing ip_address field- but there was no ip_address form field.

Digging into it, it validates the ip_address from/for the ip_address in exp_channel_titles.

Locally, I tried cloning an entry with a blank ip_address in that field- but that work. Then I stuck a 0 in the field, and boom- replicate.

Not sure why, but user had 0 in the ip_address db column for some of those entries, and if you try to clone those, it acts like there's a validation error. Though you can't see what's causing the error, because ip_address isn't a form field.

Note- tested with ip_address required to post in the settings. But no idea if that's in play- I suspect it is moot.

@robinsowell
Copy link
Contributor Author

And in case it ever comes up- you. can see the validation errors for a form submit hacking ExpressionEngine/Model/Channel/ChannelEntry.php:


            // restore our package and view paths
            ee()->load->remove_package_path($info->getPath());
        }
		
		var_dump($result->getAllErrors()); die;

        return $result;
    }

    /**
     * Validate entry count for this channel against channel's
     * max_entries setting
     */
    public function validateMaxEntries($key, $value, $params, $rule)

@intoeetive
Copy link
Contributor

The IP address is kinda special because it is the property on the ChannelEntry model, it has validation, but it's not on the page - so there is no place where the error could be shown.

Since this seems to currently be only one of this kind, I've added a "special case" to treat it.

The error message could have been better, but that's what comes from validation service (and I think it's generic on purpose)

image

intoeetive added a commit that referenced this issue Feb 22, 2024
…ss-validation

Resolved #3998 where no proper error was shown when trying to clone entry with an invalid IP address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants