Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: TheListener on July 22, 2011, 07:07:22 PM

Title: T Class error
Post by: TheListener on July 22, 2011, 07:07:22 PM
Posting here due to 3 mods being combined for one job. Help would be greatly appreciated.

Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' in /home/xxxxxxxxx/public_html/xxxxxx/Sources/CustomAction.php(90) : eval()'d code on line 39

// By any chance are we in a sub-action?
   if (!empty($_REQUEST['sa']))
   {
      $request = $smcFunc['db_query']('', '
         SELECT id_action, name, permissions_mode, action_type, header, body
         FROM {db_prefix}custom_actions
         WHERE url = {string:url}
            AND enabled = 1
            AND id_parent = {int:id_parent}',
         array(
            'id_parent' => (int) $context['action']['id_action'], LINE 39
            'url' => $_REQUEST['sa'],
         )
      );

      if ($smcFunc['db_num_rows']($request) != 0)
      {
         $sub = $smcFunc['db_fetch_assoc']($request);
Title: Re: T Class error
Post by: MrPhil on July 22, 2011, 10:45:22 PM
See the "eval"? That means you have to go into your Admin controls and turn off (disable) eval. You will get errors with (probably) a different line number and even a different file name. It's definitely not in the file you're listing. The error message says that it encountered a "class" token (keyword) where one wasn't expected.
Title: Re: T Class error
Post by: TheListener on July 22, 2011, 11:11:37 PM
The odd thing is:

Disable evaluation of templates  is already checked.
Title: Re: T Class error
Post by: MrPhil on July 23, 2011, 01:45:30 PM
Odd, there must be some eval's that aren't affected by that switch. Unfortunately, that means that you're going to have to search your code (recently modified files) for keyword "class" and understand enough PHP to know whether it's out of place.
Title: Re: T Class error
Post by: tMicky on September 19, 2012, 07:09:00 PM
Quote from: Old Fossil on July 22, 2011, 07:07:22 PM
Posting here due to 3 mods being combined for one job. Help would be greatly appreciated.

Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' in /home/xxxxxxxxx/public_html/xxxxxx/Sources/CustomAction.php(90) : eval()'d code on line 39

// By any chance are we in a sub-action?
   if (!empty($_REQUEST['sa']))
   {
      $request = $smcFunc['db_query']('', '
         SELECT id_action, name, permissions_mode, action_type, header, body
         FROM {db_prefix}custom_actions
         WHERE url = {string:url}
            AND enabled = 1
            AND id_parent = {int:id_parent}',
         array(
            'id_parent' => (int) $context['action']['id_action'], LINE 39
            'url' => $_REQUEST['sa'],
         )
      );

      if ($smcFunc['db_num_rows']($request) != 0)
      {
         $sub = $smcFunc['db_fetch_assoc']($request);
Hello, did you ever solve this issue?
Title: Re: T Class error
Post by: MrPhil on September 19, 2012, 09:43:59 PM
The code listed in the first post looks OK to me (nothing obviously wrong). If disabling eval didn't change the error message, I have to wonder if it's way off on the line numbering (i.e., line 39 is nowhere near the indicated position), or we're looking in the wrong file.

T_CLASS means that it found the token class in an unexpected place. Here, only a , or a ; should be found.
Title: Re: T Class error
Post by: tMicky on September 20, 2012, 03:25:58 AM
My error was slightly different:

Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' in ./Sources/CustomAction.php(90) : eval()'d code on line 36

I know nothing, but I have been messing around with the error:

// By any chance are we in a sub-action?
   if (!empty($_REQUEST['sa']))
   {
      $request = $smcFunc['db_query']('', '
         SELECT id_action, name, permissions_mode, action_type, header, body
         FROM smf_custom_actions (this was originally {db prefix}_custom_actions)
         WHERE url = {string:url} (This was the LINE 36 in question)
            AND enabled = 1', (added the part in red)
            AND id_parent = {int:id_parent}', (LINE 38)
         array(
            'id_parent' => $context['action']['id_action'],
            'url' => $_REQUEST['sa'],
         )
      );

Well unsurpringly those changes gave me this new error: Parse error: syntax error, unexpected T_LOGICAL_AND in ./Sources/CustomAction.php on line 38 (see LINE 38 above)

It seems to be asking for some "id" for the id_parent
Title: Re: T Class error
Post by: Deaks on September 20, 2012, 06:08:57 AM
tMicky please keep your issue to your own support topic:

http://www.simplemachines.org/community/index.php?topic=486796