4.3.1 - Block Status Errors In Block.php

I’m getting some errors since upgrading to 4.3.1

It’s related to the status change of a block

The error report is consistent and the only error being generated by the shop.

It occurs when the block status is changed.

It logs the same two lines.



PHP Notice: Undefined index: object_ids in /home/site/public_html/cart/app/Tygh/BlockManager/Block.php on line 615

PHP Notice: Undefined index: status in /home/site/public_html/cart/app/Tygh/BlockManager/Block.php on line 619




The section of code it’s referring to in Block.php is:


<br />
   /**<br />
	 * Updates block statuses<br />
	 * <i>$status_data</i> must be array with these fields:<br />
	 * <pre>array (<br />
	 *   snapping_id - if not exists will be created new record<br />
	 *   status - block status 'A', 'D'<br />
	 *   object_ids - dynamic object id<br />
	 *   object_type - dynamic object type from dynamic_objects scheme<br />
	 * )</pre><br />
	 *<br />
	 * @param  array	   $status_data Array of status data<br />
	 * @return string|bool Status value on success, false otherwise<br />
	 */<br />
	public function updateStatus($status_data)<br />
	{<br />
		if (!empty($status_data['snapping_id']) && !empty($status_data['status'])) {<br />
			if (!empty($status_data['object_type']) && !empty($status_data['object_id']) && $status_data['object_id'] > 0) {<br />
				// If it's status update for dynamic object<br />
				$block = $this->getById(null, $status_data['snapping_id'], $status_data, DESCR_SL);<br />
(LINE 615) 			  $object_ids = explode(',', $block['object_ids']);<br />
<br />
				$key = array_search($status_data['object_id'], $object_ids);<br />
<br />
(LINE 619) 			  if ($status_data['status'] == $block['status'] && isset($object_ids[$key])) {<br />
					unset($object_ids[$key]);<br />
				} elseif ($status_data['status'] != $block['status']) {<br />
					$object_ids[] = $status_data['object_id'];<br />
				}<br />
				foreach ($object_ids as $k => $v) {<br />
					if (empty($v)) {<br />
						unset($object_ids[$k]);<br />
					}<br />
				}<br />
				$status_data['object_ids'] = implode(',', $object_ids);<br />
				if (empty($status_data['object_ids'])) {<br />
					db_query('DELETE FROM ?:bm_block_statuses WHERE object_type=?s and snapping_id=?i', $status_data['object_type'], $status_data['snapping_id']);<br />
				} else {<br />
					$this->updateStatuses($status_data);<br />
				}<br />
			} else {<br />
				// If it's simple status update just do it<br />
				$this->updateSnapping(array(<br />
					'snapping_id' => $status_data['snapping_id'],<br />
					'status' => $status_data['status'],<br />
					'object_ids' => '',<br />
					'object_type' => ''<br />
				));<br />
			}<br />
			return $status_data['status'];<br />
		} else {<br />
			return false;<br />
		}<br />
	}<br />

[quote name='musicsite' timestamp='1435045030' post='220022']

I'm getting some errors since upgrading to 4.3.1

It's related to the status change of a block

The error report is consistent and the only error being generated by the shop.

It occurs when the block status is changed.

It logs the same two lines.



PHP Notice: Undefined index: object_ids in /home/site/public_html/cart/app/Tygh/BlockManager/Block.php on line 615

PHP Notice: Undefined index: status in /home/site/public_html/cart/app/Tygh/BlockManager/Block.php on line 619




The section of code it's referring to in Block.php is:

[/quote]



Try the fix from this report. See the last message: http://forum.cs-cart.com/tracker/issue-5778-cannot-enable-main-containter