Function Of This Specific Line Of Code

Hi,

I ran into an issue in our developer store when I try to update the qty of any given product in the shopping cart.

The error log showed this error

[23-Sep-2017 18:11:42 Europe/Berlin] PHP Parse error:  syntax error, unexpected 'dO' (T_DO) in /home/pasioonline/public_html/4sprung/app/functions/fn.control.php(697) : eval()'d code on line 4

I figured that I may have to dive into the code of this fn.control.php file to see what is happening at line 697

At any rate from line 681 till 704 I noticed on line 700 that something is set to "true"

/**
 * Runs specified controller by including its file
 *
 * @param string $path path to controller
 * @return array controller return status
 */
function fn_run_controller($path, $controller, $mode, $action, $dispatch_extra)
{
    static $check_included = array();
$auth = & Tygh::$app['session']['auth'];

if (!empty($check_included[$path])) {
    $code = fn_get_contents($path);
    $code = str_replace(array('function fn', ''), array('function _fn', '', ''), $code);

    return eval($code); 

} else {
$check_included[$path] = true;

    return include($path);
}

}

However this specific line set to value "false" seems to fix the issue

        $check_included[$path] = false;

but that generates another log in the error log file

[23-Sep-2017 20:09:10 Europe/Berlin] PHP Fatal error:  Uncaught  --> Smarty: Missing template name <-- 
  thrown in /home/pasioonline/public_html/4sprung/app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php on line 679

Can anyone tell me what this line of code accomplishes in the /app/functions/fn.control.php file and how setting the value from 'true' to 'false' relates to the second entry in the error log file ??

Rarely is a syntax error related to an assignment. PHP first loads everything and checks for syntax errors. After that's validated, then the code is executed (where assignments occur). So, unless there was a missing semicolon or other syntactic issue, changing the assignment would have no effect on a syntax error other than an "function 'foo' is already defined in...." fatal error..

I would try to determine which controller is generating the error. I.e. what is the value of the $path variable of the function.

The $check_installed code is basically a safety check to see if the controller is already loaded. If so, the included file is loaded into an anonymous function and then executed. I would NOT change this to false, otherwise you will get multiple definitions of the same functions and that will generate fatal errors.

Fix the root of the problem instead. If you can't figure out for yourself then you need to contact 4sprung.

/public_html/4sprung/app/functions/fn.control.php

Fix the root of the problem instead. If you can't figure out for yourself then you need to contact 4sprung.

/public_html/4sprung/app/functions/fn.control.php

I wanted to gain some more knowledge before contacting them. 8)