Page 1 of 1

Fatal Error: Just Kidding!

Posted: Mon Mar 27, 2006 10:26 am
by llfitness
So my new all time favorite error is one that is both fatal AND occurs infrequently, with no apparent pattern. Here we go:
Fatal error: Cannot redeclare text_admin() (previously declared in D:\inetpub\websites\asmarterbuy\SX\tools\error_handler.php:22) in D:\inetpub\websites\asmarterbuy\SX\tools\error_handler.php on line 33
I reload and don't get this error for at least another hour.

Here's the code. The only thing before this code in this file is comments. Line 22 is the function declaration. Line 33 is the close of that function. The <==== are not in the code and were added for demonstrative purposes.
???

Code: Select all

*/

function text_admin($subject, $message) <========== line 22
	{
	// This function is bare-bones because it will probably only be used when
	// something (like the DB connection) isn't working.
	
	$to = ADMIN_TEXT_ADDRESS;
	$from = 'domains@llfitness.com';
	$headers = 'From: ' . $from . "\r\n" .
	   'X-Mailer: PHP/' . phpversion();

	mail($to, $subject, $message, $headers);
	}   <================ line 33

function error_reporter()
	{
       ........

So what's the deal?

IIS 6 / Windows 2003 / PHP 5.1.2
[/quote]

Posted: Mon Mar 27, 2006 10:56 am
by Benjamin
What is the filename of the code you posted?

Not what I expected...

Posted: Mon Mar 27, 2006 11:04 am
by llfitness
Of all the possible issues, that hadn't even entered my brain... :)

...\asmarterbuy\SX\tools\error_handler.php

Posted: Mon Mar 27, 2006 11:09 am
by shiznatix
this type of thing seams to popup every now and then. make sure that you are including the error handler with require_once();