Jump to content

Recommended Posts

Posted (edited)

The function \IPS\Content\Widget::formElements() includes this check to skip the container field when no container class is set:

		/* Container */
		if ( isset( $class::$containerNodeClass ) )
		{
			$return['container'] = new \IPS\Helpers\Form\Node( 'widget_feed_container_' . $class::$title, isset( $this->configuration['widget_feed_container'] ) ? $this->configuration['widget_feed_container'] : 0, FALSE, array(
				'class'           => $class::$containerNodeClass,
				'zeroVal'         => 'all',
				'permissionCheck' => 'view',
				'multiple'        => true,
				'forceOwner'	  => false,
				'clubs'			  => TRUE
			) );
		}

 

The problem pops up when trying to save the widget configuration in the preConfig() function:

 	public function preConfig( $values )
 	{
	 	$class = static::$class;
	 	
 		if ( \is_array( $values[ 'widget_feed_container_' . $class::$title ] ) )
 		{
	 		$values['widget_feed_container'] = array_keys( $values[ 'widget_feed_container_' . $class::$title ] );
			unset( $values[ 'widget_feed_container_' . $class::$title ] );
 		}
 		

The code checks if the container value is an array, but never checks if the value is available in the first place. Adding a simple isset() check solves the issue.

 

Here's the full error:

Whoops\Exception\ErrorException thrown with message "Undefined array key "widget_feed_container_XXXXXX""

Stacktrace:
#7 Whoops\Exception\ErrorException in \system\Content\Widget.php:257
#6 Whoops\Run:handleError in \system\Content\Widget.php:257
#5 IPS\Content\_Widget:preConfig in \applications\CUSTOMAPP\widgets\itemFeed.php:101
#4 IPS\CUSTOMAPP\widgets\_itemFeed:preConfig in \applications\core\modules\front\system\widgets.php:224
#3 IPS\core\modules\front\system\_widgets:getConfiguration in \system\Dispatcher\Controller.php:107
#2 IPS\Dispatcher\_Controller:execute in \applications\core\modules\front\system\widgets.php:38
#1 IPS\core\modules\front\system\_widgets:execute in \system\Dispatcher\Dispatcher.php:153
#0 IPS\_Dispatcher:run in \init.php:947
Edited by teraßyte
Posted

Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...