- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
well, at least the memory doesn't run out...
Admin
Why blame the 'system'? They should blame PHP for all their bugs :)
Admin
Why blame PHP? They should blame their developer for all their bugs.
Admin
Why blame the developer? It's the tester who creates bugs.
Admin
Why blame the developer, the requirements were never formulated properly!
Admin
Ultimately, it's the keyboard that is responsible.
Admin
WTF??
Admin
Why to blame developers, when you can blame physicist who created the technology for creating computers and therefor for creating programming languages, and therefor for creating bugs. Actually we can blame Newton every single time when our code doesn't work.
Admin
"prevent writing knowledge to programmer memory from running out of memory."
Captcha: muhahaha
Admin
PHP? the developers?
It's the use of computers that is the real WTF.
Paper - it's the way forward!
Admin
The real PHP here is the Pointy-Haired Programmer.
Admin
The real WTF is that they replaced a two-liner with 8 lines of code. And unless there is a real reason for that they replaced what looks like working code with a not-tested procedure.
Admin
Blame mother nature. She's the one who created the bugs and other insects. If it wasn't for these little crawlers, we would not have bugs. Just errors...
Admin
libcurl? how about streams?
Admin
urlencoding. A file.
riiiiiight...
There are a few more programmers in this story that apparently have ran out of memory.
Admin
the problem always lies between the keyboard and chair guys.
Admin
The real WTF here is that I am not in tears from reading this. Why have two lines of code when you can have eight! 2 > 8 right guys? ... right...?
Admin
Brillant. 10/10
Addendum (2007-10-08 09:58): http://support.microsoft.com/kb/208427
Addendum (2007-10-08 10:01): I don't know why I bother on this url limit, the guy's concatenating the files before urlencoding them anyway.
Addendum (2007-10-08 10:03): I don't know why I bother this concatenating stuff, the guy's unsetting the $contents anyway. Ouch!
Admin
Yeaaaah! And it looks so enterprisy...
Admin
It seems like the real WTF is that they are trying to URL encode the entire file instead of the URL to the file.
Admin
We should actually blame GOD and send him to (programmer's) hell. After we will blame and prosecute the creators of GOD for having fucked up with the entire universe and it's surroundings.
Admin
Admin
It went from 2 to 8 obviously because file_get_contents() (grab the entire file into a string) was introduced in PHP 4.3 and they wanted it to be compatible with older versions. (Only last week I had the same problem with a client's webhost using 4.1 or something)
One WTF though that file() (grab the entire file into an array: one line per element) was not binary safe prior to version 4.3 so the whole thing is an exercise in futility! Needed to fopen(), then loop fread() until eof() then fclose(). Or just specify/use PHP 5.2 and be done with it. PHP4 will be dead very soon anyway.
Plus someone was a little too unset()-happy. Stupid people/programmers are everywhere. You can't completely blame the tools.
Admin
Admin
In my experience you can always blame the tools -- either blame the tool the program uses, or the tool that wrote it!
Admin
exit; //optimized to save memory since files don't upload anyways.
foreach (file($filename) as $line) { $contents.= $line; } $contents=urlencode($contents);
unset($line); unset($contents); unset($_FILES);
Admin
Due to the what? No distributed nature of any sort can serve as an excuse for this insanity!
Brillant! Here's a way to save even more memory:
apachectl -k stop
Admin
HAHAHA! testers? you must be joking. Testers would require someone in the business to do something that's not their job, or us to hire someone else?
Admin
What a great reuse of variables. Quite Frugal !!
Admin
Er, um, isn't urlencode() the wrong thing to use, as it breaks ampersand escapes like ... etc...?
And isn't reading a line at a time kinda slow, memory-fragmenting, and sure to goof up on binary files?
Admin
Wait, where's the WTF? It seems like this prolongEmploymentContract() function is working just fine. The new guy must be fresh out of college or have scruples or something...
Admin
Oh, sure! Blame the old guy! I mean, it's not like he's never made a WTF (the platypus?! the avacado?!) but he's made some nice stuff, too. Like unicorns and faeries.
What, no unicorns and faeries? Ok, screw that then.
Admin
I assume you write "God" in the pantheist way, as a synonym for all the laws of nature, as Newton and Einstein did?
(Oh my, did I just start a religion talk here? WTF?!?)
Admin
And while it's likely true that it will goof up binary files, it doesn't have to. Assuming that it's not doing any character encoding conversion (is keeping the same binary values), and that the read line method keeps the newline, the final variable will contain the same data anyway. (Assuming, of course, that PHP supports null characters in its strings. Which it does to a degree. Not all PHP functions do, but...)
[1] Technically, urlencode is only proper for a POST request sent as application/x-www-url-form-encoded (the default) versus multipart/form (the method usually used to send file contents). See RFC2388.
Admin
Oh, good, because you lot can be trusted to be civil and polite to each other even when you're not discussing contentious topics.
Admin
Admin
oh my god.. there are so many WTF in this code.
OMG..
Admin
Einstein, yes, but Newton!? The man spent more time on theology than on physics. There's an entire Wikipedia article just on his personal religious views: http://en.wikipedia.org/wiki/Isaac_Newton%27s_religious_views
Quote: "I have a fundamental belief in the Bible as the Word of God, written by those who were inspired. I study the Bible daily.".
Admin
Admin
Why would they need to urlencode() or base64 the file if they're using CURL to upload it? CURL can take care of that automatically.
Admin
Fred, if you are ever in Seattle, I challenge you to a Guac-Off (all in delicious good fun of course) :-P
Admin
base64 adds a lot of extra bytes you don't need. If both servers were controlled by the company, there are many good alternatives.
Write the file to disk, and then "ping" the remote webserver so that it knows there is a new file to download.
If both servers are connected locally, just put the file in a shared folder
Admin
Do you use fresh garlic in yours? I find it strange that here in Texas most guac-makers do not. It's one of the secrets of my recipe that make it stand out above the rest. :)
Admin
bang.
q: why are they reposting files in url encoded format that were already uploaded? a: because they're all idiots
who cares why the system is broken? the design was broken to begin with.
i really don't see the WTF here...some dumbass developer thought it was clever to unset some variable that was actually needed...and? it's the dumbass designers who are really to blame for requiring this awkward work around in the first place.
Admin
Admin
Yes, you did.
Where'd you get that? Some lazy philosophy professor?
Einstein was arguably deistic, but never stated anything along the lines of pantheism. (God can't "play dice" with the universe if He is the universe.)
Newton was completely Christian in his religious thought, even if it did not always match the dogma of his day. All you have to do is read his writings on the subject, which there are a lot of.
Admin
Dang, hate not hitting "quote". Just look above...
Admin
Alan Turing did a lot of work with computation (and thus assembly) before the technology exists. How do you then blame the machines when computation can be down without?
Admin
I believe the "play dice" thing was meant to be figurative -- a comment on the philosophical inelegance of a universe ruled by chance, rather than an implicit assumption about a willful divinity.
Here's a quote from his article "Science and Religion". It seems pretty clear to me that he doesn't believe in the "doctorine of a personal God, interfering with natural events".
"The more a man is imbued with the ordered regularity of all events the firmer becomes his conviction that there is no room left by the side of this ordered regularity for causes of a different nature. For him neither the rule of human nor the rule of divine will exists as an independent cause of natural events. To be sure, the doctrine of a personal God interfering with natural events could never be refuted, in the real sense, by science, for this doctrine can always take refuge in those domains in which scientific knowledge has not yet been able to set foot."
Admin
Okay, I'll bite: What the heck is WTF-y about avocados? Is there something I don't know about them? (Would I figure out the WTF if I just looked at the "avocado" entry on Wikipedia?)