I have this code that I copied from this link. It is a user made class to read/write ini files. I'm only using it because the parse_ini_file() seems to error out when the data contains a dollar sign ($) which my ini file has lots of.

This code works, but it generates a seemingly harmless error at the bottom of my php page which is annoying. The error I get is:
Invalid argument supplied for foreach()
in the READ INI section:
PHP Code:
$buf get_defined_constants(true);
$consts = array();
foreach(
$buf['user'] as $key => $val) {
    
$consts['{'.$key.'}'] = $val;
}
array_walk_recursive($ini, array('INI''replace_consts'), $consts);
return 
$ini
I'm a beginner at PHP and this specific foreach construct is a little new to me and I just don't know what is wrong with this code that would make it generate that error. I've tried my own hand at debugging and tweaking and anything I do just breaks the code. I would be willing to leave this code be if I could tell PHP to silence the error but I don't know how to do that without silencing all errors for the entire webserver.

Any help is much appreciated.