Annoying Poll

Where we keep all the boring tidbits about the PHPDN site, the news, and what not.

Moderator: General Moderators

Most annoying type/bug/error in PHP.

Missing ;
22
15%
if ( $supersecretpw = $test_password )
17
12%
((())())(()))(())((())
16
11%
}...hrm, now which one does this go to?
25
17%
Headers already sent, damnit!
36
25%
Notice: Undefined variable...grrr
7
5%
Function does not exist...*boom!*
5
3%
Internal Server Error 500...Noooooo!!!!
7
5%
.asp/.cfm/.jsp/.pl
0
No votes
Cannot access phpdn database. Database is unreachable...
10
7%
 
Total votes: 145

magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

Yea i missed that the first time around - doh! I'm working on figuring out how to restore from bin-log now. I only need the day so im going to convert to DATE and then just make it now() on insert.
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

A missing . (dot) in a line of code of over 400 characters long. It took 3 people for a half hour to find it :?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

magicrobotmonkey wrote:Yea i missed that the first time around - doh! I'm working on figuring out how to restore from bin-log now. I only need the day so im going to convert to DATE and then just make it now() on insert.
It's easy:
  • restore your database from backup
  • then use mysqlbinlog utility to convert the binlogs to SQL queries (save its output to file)
  • remove that update query from the file
  • feed the file to mysql utility:

    Code: Select all

    cat filename.sql | mysql -u username -p -h hostname
User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Post by HaVoC »

Bill H wrote:
And so on until I realize I was moving the wrong file to the server.
Or this one always cracks me up when I do it.

After repeated uploads and tests WS_FTP times out and disconnects. No, I don't fail to notice that and reconnect. I reconnect and fail to upload the modified file! Then I can't figure out why my change didn't work. Seems I somehow think that merely reconnecting is all I need to do!
:oops:
WS_FTP Pro re-sends the file on reconnect ^_^.
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

for me it has to be a missing ' or " which throws an error on the last line of the file
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Personally, I vote for 500 errors. They are so damn hard to correct it's not even funny. I speak as a person who spent hours trying to troubleshoot that piece of sh8t error to no avail, until something finally came through for me. 500 Is the most annoying and uninformative error in computer programming.
impatientone
Forum Newbie
Posts: 1
Joined: Wed Jun 30, 2004 5:56 pm

Hrm...

Post by impatientone »

We had just finished a year long contract that was huge and difficult but was finally working, tested and stable. The same day we launched it I had 2 simple tasks... upgrade the php install and catch a flight to the balkans for the summer so I could go on vacation.

I get to the hostel, I am a few (a dozen or more) beers in and I decide to check my webmail..

Somehow I had disabled the

Code: Select all

<? short tags
and now the clients site was spitting back all of my code..
Ugh, thank god our sysadmin is a god. He so saved my ass.. the last thing I wanted was the check that I was travelling off of to be the last one I got from the company I work for.. Would have wrecked a damned good vacation.

?>
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

blame it on the boo's

lol
Kelvin
Forum Newbie
Posts: 1
Joined: Thu Jul 01, 2004 7:07 pm

Most Stupid Mistake Ever

Post by Kelvin »

A friend of mine, relatively new to programming, once spent the best part of a fortnight trying to write a complex (for him) if() statement that would execute when the result of part of the comparison evaluated to null
After much deliberation he consulted me..
I pointed out the NOT keyword
....
He dropped the project and never went back to it
tom.z
Forum Newbie
Posts: 1
Joined: Thu Jul 08, 2004 8:22 am
Location: Tunis,Tunisia
Contact:

missing ';'

Post by tom.z »

i think spending 2 hours debugging a script to know in the end that a ';' is missing , is a good purpese to suicide :evil:
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

I find that after 8 hours a day of coding I end up putting ";" on the end of everything;

Most annoying when you quickly but perfectly type a url into a browser and end it with ";" and hit enter! :evil:
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Skittlewidth wrote:I find that after 8 hours a day of coding I end up putting ";" on the end of everything;
; ;)
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

McGruff wrote:The worst are the ones which spit out a line number far removed from the source of the problem.
I would like to say I have a pretty solution to that problem.

First of all: DONT have SHOW_BACKTRACE_ON_ERROR == true except during development. If an error occurs, debug_backtrace() does not hide anything that should be secret...

This error message function, shout(), can echo, email, and backtrace your errors. Very useful.

Code: Select all

<?php
	function backtraceTable($arrBackTraces){
		//Alright... This one is not pretty, 
		//but I was in coding mode="general,portable" that day...
		$strTable = "<table style="font-family:Tahoma" border="1">\n<tr style="font-weight:bold"><td>" . 
						join("</td><td>" , array_keys($arrBackTraces[0])) . "</td></tr>\n";
		foreach ($arrBackTraces as $arrBackTrace){
			$strArguments = '';
			$argCount = 0;
			foreach ($arrBackTrace['args'] as $arg){
				$strArguments .= "<b>" . ++$argCount . "</b> " . $arg . "<br>\n";
			}
			$arrBackTrace['args'] = $strArguments;
			$strTable .= "<tr><td>" . join("</td><td>" , $arrBackTrace) . "</td></tr>\n";
		}
		$strTable .= "</table>";
		return $strTable;
	}

	function shout($strError){
		if (constant('SHOW_BACKTRACE_ON_ERROR')){
			$strError .= backtraceTable(debug_backtrace());
		}
		
		if (constant('ECHO_ERR_MESSAGES')) {
			echo "<pre style="color:red">" . $strError . "</pre>";
		}
		$strError = "[{$_SERVER['REMOTE_ADDR']} - {$_SERVER['REMOTE_HOST']}]: $strError";
		
		$strTime = time() . " - " . strftime("%a %d %b %y %H:%M:%S %Z") . " - " . basename($_SERVER['SCRIPT_NAME']) . "  --  ";
		if (constant('MAIL_ERR_MESSAGES')) {
			mail(	constant('EMAIL_ADMIN'), 
					'Error at: ' . $_SERVER['HTTP_HOST'], 
					"$strTime\n$strError\n", 
					(strlen(constant('EMAIL_SENDER')) ?  "From: " . constant('EMAIL_SENDER') : null)
					);
		}
		
		if (constant('LOG_ERR_MESSAGES')) {
			$strBail = "Cannot open logfile for appending complaint  ( " . constant('LOG_ERR_MESSAGES_LOGFILE') . " )";
			clearstatcache();
			if (!$handle = fopen(constant('LOG_ERR_MESSAGES_LOGFILE'), 'a')) {
					echo "fopen(): " . $strBail;
					exit;
			}
		
			if (fwrite($handle, "$strTime$strError\n") === FALSE) {
					echo "fwrite(): " . $strBail;
					exit;
			}
			fclose($handle);
		}
		return FALSE;
	}

?>
But the reason I come back to this thread is that I did the unforgivable deed during saturday. I have been using linux regularily for about three years now, and have never actually done something so carelessly as what I did saturday.
I was at home... as root... Thought I was somewhere else, namely in a cache folder for my template engine... then I issued:

Code: Select all

rm -rf *
one... two seconds... ALL HAIR RIIIIISE!
CTRL+C!

Then I actually saw nothing important was missing.
I have no idea about where the recursion started working, but everything works as usual. It must have been running off an old manual folder with several thousands of files laying around, because everything important to me seems to be where it should be.

Conclusion:
1 Never do that.
2 Always keep your home directory really really really really bloated...
prov
Forum Newbie
Posts: 10
Joined: Thu Mar 25, 2004 9:13 pm
Location: Providence, RI
Contact:

Post by prov »

For me it would have to be the infinate loop. I think I inadvertantly nuked my host's server on three separate occasions before the host finally modified their server to time out after my script has been running a loop for 5 seconds. I'm lucky I have such a patient host that didn't just revoke my account. :)

In terms of unreversable errors, I'd have to say it's updating or deleting the mysql query without a where clause. It only happened to me once, but that is a mistake I'll remember never to make again.

In terms of head-banging typos that leave you pulling your hair out until you realize it's just a misplaced (or missing) character, the award would have to go to the missing } somewhere. Fortunately, I use a PHP editor that makes it easier to find where it is, but it still takes some brain work. To make matters worse, I rarely tab my control structures.
dfdugal
Forum Newbie
Posts: 3
Joined: Tue Aug 24, 2004 6:22 pm
Location: Peoria, IL
Contact:

Post by dfdugal »

My favorite is digging through logs and finding "PHP Fatal error: Call to a member function on a non-object in ..." I hate those.
Post Reply