I know this is a little late, but I recently ran into a similar problem. I figured I would share what I did for anyone who may come across this post like I did. I have modified(hacked) the original core code, so this may not be for everybody, but it is a pretty simple solution.
After investigating how MODx generates those error messages, I found in /manager/includes/document.parser.class.inc.php that MODx uses a set_error_handler() function which is why setting error_reporting(0) does nothing. The error handling function is called phpError() and is actually a method of the DocumentParser class. The key paramter to look at in this method is $nr which is actually the error number generated when PHP hits an error. By default, when an error occurs, the MODx error page is always displayed UNLESS the PHP error is of level E_NOTCIE-8 AND $modx->stopOnNotice == false. By default, $modx->stopOnNotice = false, but when fopen() fails an error level E_WARNING-2 is generated, same with file_get_contents(). So the error page still shows up. Here is the original phpError() method:
function phpError($nr, $text, $file, $line) {
if($nr==8 && $this->stopOnNotice==false) {
return true;
}
if (is_readable($file)) {
$source = file($file);
$source = htmlspecialchars($source[$line-1]);
} else {
$source = "";
} //Error $nr in $file at $line: <div><code>$source</code></div>
$this->messageQuit("PHP Parse Error", '', true, $nr, $file, $source, $text, $line);
}
So what I did was edit this method to ignore E_WARNING errors along with E_NOTICE. Just change the first IF statement in phpError() to
if(($nr==8 || $nr == 2) && $this->stopOnNotice==false)
This seems to fix it for my needs anyway. I’d prefer not to edit the core code, but this was the only option I could think of. I think using @ before fopen() doesn’t work because that just supresses the error message from displaying, but the error is still generated internally I think. Anyway, thats all you need to do - edit /manager/includes/document.parser.class.inc.php and overwite the one on the server. Also, make sure you have $modx->stopOnNotice == false in your index.php.
P.S. - It would be nice for future MODx releases to have an option in the admin panel to choose what error levels you want to be ignored.
-Chris O.