View Full Version : Problems seeing error messages
KevinM
12-04-2005, 07:05 AM
It's been a while since I have done anything in PHP, and I thought it's time to start upgrading my custom scripts on my forum to work with 3.5.1.
My problem is that the PHP errors are not being outputed to the screen, so debugging my own scripts is difficult. (I just get blank screen).
I have the 'error_reporting(E_ALL & ~E_NOTICE);' at the top of the page and the only vb page included is global.php.
I don't remember having this when I was working on 3.0 (but I might be wrong / or perhaps i didn't make any coding errors ;) ).
What do I need to do to see the php errors?
Marco van Herwaarden
12-04-2005, 07:13 AM
You should always see PHP errors. Could you be a bit more specific?
KevinM
12-04-2005, 07:39 AM
This is part of a custom script I used in 3.0 and am now upgrading to 3.5.
What I mean by not showing errors, is that if I make a typo (e.g. leave off a ';') I still don't get an error message, just a blank screen.
Any ideas?
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'view_headers');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'viewheaders', 'viewheaders2'
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'View Message Headers';
// make sure we keep the post number
$postheaders = $_GET['p'];
// and the thread
$threadneeded = $_GET['t'];
if ($postheaders){
$get_headers=$db->query("SELECT * FROM " . TABLE_PREFIX . "post WHERE postid = " . $postheaders . "");
$get_headers=$db->fetch_array($get_headers);
}
if (!$get_headers["headers"])
{
$get_headers["headers"] = "No headers were kept for this post. Headers were only archived after October 2005 for posts originating from outside of this forum.";
}
$get_headers["headers"] = str_replace("<", "?", $get_headers["headers"]);
$get_headers["headers"] = str_replace(">", "?", $get_headers["headers"]);
$get_headers["headers"] = htmlspecialchars($get_headers["headers"]);
$get_headers["headers"] = str_replace(":: ", ": </div></strong></td><td class=\"alt1\">",$get_headers["headers"]);
$get_headers["headers"] = str_replace("\r\n", "</td></tr><tr><td valign=\"top\" class=\"alt1\"><strong><div align=\"right\">",$get_headers["headers"]);
} else {
$headerserror = "An error occurred, no post specified";
}
// display headers
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('viewheaders2') . '");');
}
?>
Marco van Herwaarden
12-04-2005, 08:05 AM
I don't see why you shouldn't be getting PHP errors.
KevinM
12-04-2005, 11:02 AM
Ok, I think it must be a php configuration problem.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.