Skip to content

null value is possible when array is expected #767

@banderon

Description

@banderon

The render_field() method in the Fieldmanager_Context class has the following code:

$data = array_key_exists( 'data', $args ) ? $args['data'] : null;
...
$field = $this->fm->element_markup( $data );

This makes it possible for $data to be null. However, the element_markup() method that's called above (from the Fieldmanager_Field class) expects an array only.

* @param array $values The current values of this element, in a tree structure
...
public function element_markup( $values = array() ) {
	$values = $this->preload_alter_values( $values );

Likewise, the preload_alter_values() method that's immediately called also expects and returns an array.

 * @param  array $values The values to load.
 * @return array $values The loaded values.
 */
public function preload_alter_values( $values ) {
	return apply_filters( 'fm_preload_alter_values', $values, $this );
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions