Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

4.3.1 - Block Status Errors In Block.php Rate Topic   - - - - -

 
  • musicsite
  • Junior Member
  • Members
  • Join Date: 22-Dec 10
  • 20 posts

Posted 23 June 2015 - 07:37 AM #1

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:

   /**
	 * Updates block statuses
	 * <i>$status_data</i> must be array with these fields:
	 * <pre>array (
	 *   snapping_id - if not exists will be created new record
	 *   status - block status 'A', 'D'
	 *   object_ids - dynamic object id
	 *   object_type - dynamic object type from dynamic_objects scheme
	 * )</pre>
	 *
	 * @param  array	   $status_data Array of status data
	 * @return string|bool Status value on success, false otherwise
	 */
	public function updateStatus($status_data)
	{
		if (!empty($status_data['snapping_id']) && !empty($status_data['status'])) {
			if (!empty($status_data['object_type']) && !empty($status_data['object_id']) && $status_data['object_id'] > 0) {
				// If it's status update for dynamic object
				$block = $this->getById(null, $status_data['snapping_id'], $status_data, DESCR_SL);
(LINE 615) 			  $object_ids = explode(',', $block['object_ids']);

				$key = array_search($status_data['object_id'], $object_ids);

(LINE 619) 			  if ($status_data['status'] == $block['status'] && isset($object_ids[$key])) {
					unset($object_ids[$key]);
				} elseif ($status_data['status'] != $block['status']) {
					$object_ids[] = $status_data['object_id'];
				}
				foreach ($object_ids as $k => $v) {
					if (empty($v)) {
						unset($object_ids[$k]);
					}
				}
				$status_data['object_ids'] = implode(',', $object_ids);
				if (empty($status_data['object_ids'])) {
					db_query('DELETE FROM ?:bm_block_statuses WHERE object_type=?s and snapping_id=?i', $status_data['object_type'], $status_data['snapping_id']);
				} else {
					$this->updateStatuses($status_data);
				}
			} else {
				// If it's simple status update just do it
				$this->updateSnapping(array(
					'snapping_id' => $status_data['snapping_id'],
					'status' => $status_data['status'],
					'object_ids' => '',
					'object_type' => ''
				));
			}
			return $status_data['status'];
		} else {
			return false;
		}
	}


 
  • imac
  • Head of Product
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 2073 posts

Posted 23 June 2015 - 11:56 AM #2

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:


Try the fix from this report. See the last message: http://forum.cs-cart...main-containter
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug