skip to Main Content

I don’t know what’s wrong with my code.
There is an error:

Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /home/&&&&/public_html/oscommerce/admin/modules.php(313) : eval()'d code on line 1

This is the Line 313

eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");

Values:

$value['set_function'] contains tep_cfg_select_option(array('Live', 'Sandbox'),

$value['value'] contains Live

$key contains CONFIGURATION_PAYPAL

4

Answers


  1. One possible reason is that the parenthesis don’t seem to match. You have 2 ) at the end while you only have one ( .

    Login or Signup to reply.
  2. eval(‘$keys .= ‘ . $value[‘set_function’] . “‘” . $value[‘value’] . “‘, ‘” . $key . “‘);”);

    Will give you something like

    $keys .= set_function'value', 'key');
    

    That’s not correct I believe.

    How about adding ( after $value['set_function'] . " ? You haven’t opened the bracket after name of the function.

    Another thing is that T_NS_SEPARATOR error means that you have somewhere where it shouldn’t be. Per: https://stackoverflow.com/a/6454891/2028547 – see the values of all your variables for weird characters.

    Login or Signup to reply.
  3. Looks like whatever is in $value['set_function'] or $value['value'] or $key have a in
    them

    Try echoing what’s in eval() rather than running eval() – this will let you see the code PHP is trying to run.

    The error is basically saying that there’s a namespace seperator () in a strange place within the eval()‘d code

    Login or Signup to reply.
  4. Are you absolutely sure you want to use eval()?

    PHP documentation for
    eval() says

    The eval() language construct is very dangerous because it allows
    execution of arbitrary PHP code. Its use thus is discouraged. If you
    have carefully verified that there is no other option than to use this
    construct, pay special attention not to pass any user provided data
    into it without properly validating it beforehand.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search