The get_config() function uses the prefix_datalists table to read the $CFG->debug value. If this value is set in config.php as well, the database value overrides the config.php value because it is read later. The documentation of the get_config() function falsely states that it will not overwrite existing config values. Due to a patch by someone with initials 'Rho', the $CFG->debug value is overwritten. The admin panel (mod/elggadmin/index.php?view=all) shows the value from config.php as read only, but the code actually uses the value from the database. This completely brakes debugging when the config.php variable is used.
Reproduce: make a standard install of elgg. Then edit config.php and add:
$CFG->debug = E_ALL; // Sets all debugging, value 2047
Now open the admin panel. It will show 'show all errors' in the debug section. If you create a deliberate error somewhere in one of the modules, you should be able to verify that debugging is actually turned off completely due to the value '0' in the prefix_datalists table.