News:

Wondering if this will always be free?  See why free is better.

Main Menu

T Class error

Started by TheListener, July 22, 2011, 07:07:22 PM

Previous topic - Next topic

TheListener

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);

MrPhil

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.

TheListener

The odd thing is:

Disable evaluation of templates  is already checked.

MrPhil

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.

tMicky

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?

MrPhil

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.

tMicky

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

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Advertisement: