I am trying to block some error messages from the screen, but having no luck.
I have a file in a php app I developed over the last 10 years. Now, the app is throwing error messages at me and I cannot figure out how to turn those message off. I think I can solve the error, but I have not been able to figure how prevent php from reporting this error in the display screen.
The file I am talking about is function file. containing a lot of long functions. Here is a section of that file that throws an error:
Code: Select all
if(function_exists('bounce')):else:
function bounce($bounce_type){
$back=debug_backtrace (DEBUG_BACKTRACE_PROVIDE_OBJECT,1);
puttrace(__LINE__,__FILE__, 'called by',basename($back[0]['file'].' line: '.$back[0]['line']));
puttrace(__LINE__,__FILE__, 'BOUNCING FOR NON '.$bounce_type.' CREDENTIALS', 'BOUNCING FOR NON '.$bounce_type.' CREDENTIALS');
switch($bounce_type):
case('logged in'):
$bounce_msg='Thank you for your interest in exploring our website. Special authorization is required for access to this area.';
break;
case('admin'):
$bounce_msg='Thank you for your interest in exploring our website. Administrators are authorized to access this area.';
break;
case('affiliate'):
$bounce_msg='Thank you for your interest in exploring our website. Affiliates are authorized to access this area.';
break;
default:
$bounce_msg='Please try again later. Thank you.';
break;
endswitch;
?>
<html>
<head>
<body>
<script><?
$destination=climbDir($GLOBALS['baseURL'],1);?>
alert('<?=$bounce_msg?> Nearest destination to the one requested: <?= basename($destination) ?>. Checking for authorization to that area...');
window.location = '<?= $destination?>'
</script>
</body>
</head>
</html><?php
die;
}
endif;
Parse error: syntax error, unexpected '}' in /var/www/www.legacy-systems.biz/htdocs/longview2 ... ctions.php on line 1027
To try blocking the error message from appearing, I tired inserting error_reporting funciton calls, but that made no difference?
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);
Those code blocks were placed inside the php function having the problem.
Any ideas or suggestions for putting an end to these problems?