Jump to content

Parse error: syntax error, unexpected 'exit' (T_EXIT)


Recommended Posts

Hi,

 

I'm new to this forum so not so sure if I'm posting in the right place or about the full rules and regulations of the forum system, so if I've got something wrong please redirect me and let me know.

Basically, I'm receiving a parse error when trying to go onto our website - I had tried restoring my website from an old backup and now it's giving me this error: 

 

Parse error: syntax error, unexpected 'exit' (T_EXIT) in /home/cdchk/domains/dev.cdchk.org/public_html/wp-content/plugins/woocommerce-catalog/include/php/settings.php on line 1

 

I tried looking into this file (settings.php under the WooCommerce Catalog Plugin files), but am lost as to what the error is. I will post the first section of the code below. Let me know if there's an issue. Thanks.

<?php

if (!defined('ABSPATH')) exit;
class Woo_Catalog_Settings

	{
	private $dir;
	private $file;
	private $assets_dir;
	private $assets_url;
	private $settings_base;
	private $settings;
	public

	function __construct($file)
		{
		$this->file = $file;
		$this->dir = dirname($this->file);
		$this->assets_dir = trailingslashit($this->dir) . 'include';
		$this->assets_url = esc_url(trailingslashit(plugins_url('/include/', $this->file)));
		$this->settings_base = 'woo_Catalog_';

		// Initialise settings

		add_action('admin_init', array(
			$this,
			'init'
		));

		// Register plugin settings

		add_action('admin_init', array(
			$this,
			'register_settings'
		));

		// Add settings page to menu

		add_action('admin_menu', array(
			$this,
			'add_menu_item'
		));

		// Add settings link to plugins page

		add_filter('plugin_action_links_' . plugin_basename($this->file) , array(
			$this,
			'add_settings_link'
		));
		}

	/**
	 * Initialise settings
	 * @return void
	 */
	public

	function init()
		{
		$this->settings = $this->settings_fields();
		}

neither the {} around the exit or () on the end of exit are required, nor does the lack of them throw a syntax error.

 

since the error gives line 1 as where the problem is being detected at and there's no statement on line 1, either this isn't the actual code the error is referring to or there's something going on with the file's character encoding or a broken php installation that's causing the problem.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.