: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if( $data = $action_class->process($action[ 'settings' ], $this->_form_id, $this->_data ) )
$this->_data = apply_filters( 'ninja_forms_post_run_action_type_' . $action[ 'settings' ][ 'type' ], $data );
// $this->_data[ 'actions' ][ $type ][] = $action;
$this->maybe_halt( $action[ 'id' ] );
do_action( 'ninja_forms_after_submission', $this->_data );
* Upon request, preserve a resumed action's extra data from before halt
private function maybePreserveExtraData(): void
isset($this->_data['resume']) &&
isset($this->_data['resume']['preserve_extra_data'])
$preservedKey = $this->_data['resume']['preserve_extra_data'];
if (isset($this->_data['extra'][$preservedKey])) {
$this->_form_data['extra'][$preservedKey] = $this->_data['extra'][$preservedKey];
protected function validate_field( $field_settings )
$field_settings = apply_filters( 'ninja_forms_pre_validate_field_settings', $field_settings );
if( ! is_string( $field_settings['type'] ) ) return;
$field_class = Ninja_Forms()->fields[ $field_settings['type'] ];
// if field_class is neither object nor string return before method_exists call
if(!is_object($field_class) && !is_string($field_class)){
if( ! method_exists( $field_class, 'validate' ) ) return;
if( $errors = $field_class->validate( $field_settings, $this->_form_data ) ){
$field_id = $field_settings[ 'id' ];
$this->_errors[ 'fields' ][ $field_id ] = $errors;
protected function process_field( $field_settings )
if( ! is_string( $field_settings['type'] ) ) return;
$field_class = Ninja_Forms()->fields[ $field_settings['type'] ];
if( ! method_exists( $field_class, 'process' ) ) return;
if( $data = $field_class->process( $field_settings, $this->_form_data ) ){
$this->_form_data = $data;
protected function maybe_halt( $action_id )
if( isset( $this->_data[ 'errors' ] ) && $this->_data[ 'errors' ] ){
if( isset( $this->_data[ 'halt' ] ) && $this->_data[ 'halt' ] ){
Ninja_Forms()->session()->set( 'nf_processing_data', $this->_data );
Ninja_Forms()->session()->set( 'nf_processing_form_data', $this->_form_data );
Ninja_Forms()->session()->set( 'nf_processing_form_cache', $this->_form_cache );
array_push( $this->_data[ 'processed_actions' ], $action_id );
protected function sort_form_actions( $a, $b )
if( ! isset( Ninja_Forms()->actions[ $a->get_setting( 'type' ) ] ) ) return -1;
$a = Ninja_Forms()->actions[ $a->get_setting( 'type' ) ];
if( ! isset( Ninja_Forms()->actions[ $a[ 'settings' ][ 'type' ] ] ) ) return -1;
$a = Ninja_Forms()->actions[ $a[ 'settings' ][ 'type' ] ];
if( ! isset( Ninja_Forms()->actions[ $b->get_setting( 'type' ) ] ) ) return 1;
$b = Ninja_Forms()->actions[ $b->get_setting( 'type' ) ];
if( ! isset( Ninja_Forms()->actions[ $b[ 'settings' ][ 'type' ] ] ) ) return 1;
$b = Ninja_Forms()->actions[ $b[ 'settings' ][ 'type' ] ];
if ( $a->get_timing() == $b->get_timing() ) {
if ( $a->get_priority() == $b->get_priority() ) {
return ( $a->get_priority() < $b->get_priority() ) ? -1 : 1;
return ( $a->get_timing() < $b->get_timing() ) ? -1 : 1;
public function shutdown()
$error = error_get_last();
if( $error !== NULL && in_array( $error[ 'type' ], array( E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR ) ) ) {
$this->_errors[ 'form' ][ 'last' ] = esc_html__( 'The server encountered an error during processing.', 'ninja-forms' );
if( current_user_can( 'manage_options' ) && isset( $error[ 'message' ] ) ){
$this->_errors[ 'form' ][ 'last_admin' ] = '<pre>' . $error[ 'message' ] . '</pre>';
$this->_errors[ 'last' ] = $error;
Ninja_Forms()->logger()->emergency( $error[ 'message' ] );
protected function form_data_check()
if( $this->_form_data ) return;
if( function_exists( 'json_last_error' ) // Function not supported in php5.2
&& function_exists( 'json_last_error_msg' )// Function not supported in php5.4
$this->_errors[] = json_last_error_msg();
$this->_errors[] = esc_html__( 'An unexpected error occurred.', 'ninja-forms' );
protected function is_preview()
if( ! isset( $this->_form_data[ 'settings' ][ 'is_preview' ] ) ) return false;
return $this->_form_data[ 'settings' ][ 'is_preview' ];
* Overwrite method for parent class.
protected function _respond( $data = array() )
// Restore form instance ID.
if(property_exists($this, '_form_instance_id')
&& $this->_form_instance_id){
$this->_data[ 'form_id' ] = $this->_form_instance_id;
// Maybe update IDs for field errors, if there are field errors.
if(isset($this->_errors['fields']) && $this->_errors['fields']){
foreach($this->_errors['fields'] as $field_id => $error){
$field_errors[$field_id . '_' . $this->_instance_id] = $error;
$this->_errors['fields'] = $field_errors;
// Set a content type of JSON for the purpose of previnting XSS attacks.
header( 'Content-Type: application/json' );
// Call the parent method.
* Process fields merge tags for fields inside a repeater fieldset
* @param object $field The Repeater Fieldset
protected function process_repeater_fields_merge_tags( $field ){
//Compare the Repeater field passed calling the function with the array of fields values from the submission object
foreach( $this->_form_data['fields'][$field->get_id()]['value'] as $id => $data ){
//Check if field is a Repeater Field
if( Ninja_Forms()->fieldsetRepeater->isRepeaterFieldByFieldReference($id) && !empty($data['value']) && is_string($data['value']) ) {
//Merge tags in the Repeater Field Sub Fields values
$this->_form_data['fields'][$field->get_id()]['value'][$id]['value'] = apply_filters( 'ninja_forms_merge_tags', $data['value'] );