The CodKep framework has some debugging function to help the developers to troubleshoot the site.

Dumping arbitrary data objects

There is three debugging functions which can receive any kind of complex data and prints the content in human readable way. All of this three function can used to display any kind of data, simple string or complex array or objects. The functions differs in output method.

d0($arbitrarydata,$rdf = '')
Prints the parameter passed variable's content to the /tmp/DEBUG file unbuffered way. It can prints the whole structure of the passed parameter. The $rdf parameter is an optional suffix string which added to the output file name to /tmp/DEBUG. (For example if the $rdf is "cache" the output is written to the /tmp/DEBUG_cache file.)

Prints the parameter passed variable's content to the standard error output of webserver which usually the error log file. (In case of the apache2 with default configuration it will be written to /var/log/apache2/error.log)

Prints the parameter passed variable's content to the end of the html page. The output of this function will be added to a special buffer and appended to the end of html data. This way the output will be visible on the generated page.

Example of printable variables:

d1("Reached code X"); //simple string

$v = NULL;
d1($v); //Can be a NULL value, this case the NULL string is printed

$a = ['key' => 'value'];
d1($a); //Can be any kind of array, the whole structure is printed.

$o = new stdClass();
$o->attribute = 'XyZ';
d2($o); //Can be an object too.

Examine an unknown received parameter:

function hook_somemodule_somehook($parameter)
    //Prints the structure and the content of the received parameter

Special pages

The CodKep has some internal route which can show some useful debugging information. In order to reach this pages you have to enable some settings in site settings.

Note: It's recommended to disable this debugging possibilities in production environment

PathEnabling variable in site settings (Set "true" to enable)Description
hooks$site_config->enable_hook_table_infoShows the available hooks in the system. (Collects the fake hook definitions, which started with _HOOK)
hookcalls$site_config->enable_hook_table_infoShows the hook calling table, which shows the implemented hooks and hook orders in the system.
codkeproutes$site_config->enable_route_table_infoShows the defined routes in the system.

Debug sql calls

If you set the $site_config->show_sql_commands_executed variable to true in site settings the CodKep appends all executed SQL command to the end of the page.

global $site_config;
$site_config->show_sql_commands_executed = true;

Dump the parameters of the page

This function returns a html table shows the CodKep's defined parameters of the current page. It shows all of the POST/GET/URL parameter names, received values and the security class too.

function mypagecallback()
  print "<h1>This is my page</h1>";
  print parameter_debug();
  return ob_get_clean();

This function only shows the parameters defined by CodKep. Because it's not recommended to use $_GET, $_POST arrays directly this function won't show the values of these which not defined in CodKep. (To understand this read parameter documentation).

Despite of this you can print the directly received parameters of the page with the following way:

//Prints the get parameters at the end of the page
// or post parameters.
Page generated in 0.0129 seconds.