ActionScheduler_Store::validate_action()
InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4.
Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However, with custom tables, we use an indexed VARCHAR column instead.
Method of the class: ActionScheduler_Store{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->validate_action( $action );
- $action(ActionScheduler_Action) (required)
- Action to be validated.
ActionScheduler_Store::validate_action() ActionScheduler Store::validate action code WC 9.2.3
protected function validate_action( ActionScheduler_Action $action ) { if ( strlen( wp_json_encode( $action->get_args() ) ) > static::$max_args_length ) { // translators: %d is a number (maximum length of action arguments). throw new InvalidArgumentException( sprintf( __( 'ActionScheduler_Action::$args too long. To ensure the args column can be indexed, action args should not be more than %d characters when encoded as JSON.', 'woocommerce' ), static::$max_args_length ) ); } }