- 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
I'm fairly certain that the second parameter to strip_tags() shouldn't be a few blank lines...
Admin
But the unused parameter is called $thumps. Perhaps the previous developer realised that it wasn't actually helping, even with the most recalcitrant of directories.
I'm not sure I quite understand the last line, though. "Remember"? Does someone else need to learn about HTML comments?
Admin
No, you misunderstand - the original developer wanted to pass the second parameter (fore reference - that would be an optional string $allowable_tags) but he drew a blank on what that would be.
Admin
$thumps is surely a leftover from when this function would clobber files that didn't match the spec. That's normal for a getter function, right?
Admin
Total Recall is based on a short story by Philip K. Dick named “We Can Remember It For You Wholesale”.
Admin
German developer with intermediate language skills.
Admin
...+1 yeah it's short for thumpnails
Admin
(You can delete this comment now, like yesterday.)
Admin
Admin
Admin
TRWTF is that Curtis forgot to rename the function to real_getpictures().
Admin
Well, the "p" makes sense once you have felt a German thumb. They are fiery and tough and are not represented correctly by a soft "b"
Admin
Admin
"...+1 yeah it's short for thumpnails"
Well, when all you have is a hammer...
Admin
Was this article written by Google Translate?
Admin
FTFY a.k.a. FTFYO
Admin
"However the $thumbs parameter isn't being used anywhere in the function. And that's a strike against any API."
So how many times can we find the phrase "This parameter is reserved and must be set to zero" on the M$DN site?
Admin
Everybody knows try...catch... blocks are only for debugging purposes, so at least that was done right.
Admin
Admin
The suspense when you are finally about to hit the "save" button... Alfred Hitchcok himself couldn't have done better!
Admin
And if a joke has to be explained, it couldn't have been that funny to begin with. Sigh.
Admin
I saw that line coming the second I read the title. It wasn't funny when it did, much like a cracker joke isn't funny.
Admin
If you haven't watched the movie (and don't know the original short story's title), then you don't get it.
For those in the know, it's funny, all others need to have it explained.
So don't let that comment stop you from making movie/book references.
Admin
+42
Admin
Admin
TRWTF is PHP and the 20 different ways to do the exact same thing, only with 10 that don't work and 5 that stay in the library even though they open your system to remote exploits.
Admin
TRWTF is that you can even fopen($directoryurl, "r") and expect to get anything valid...
http://www.php.net/manual/en/function.fopen.php
Admin
It's $directoryurl. Not $directorypath.
I fully expect that what's being passed is something akin to http://images.example.com/path/to/directory and they're relying on the directory index. (Hence the need to remove the tags from the output.)
Admin
Admin
Ausgabe? Die muttersprache!
People who write code in mixed languages should be hung upside down by their fingers and toes and fed blood thinners and bled with needles and left for the scavengers to find.
Admin
Anyone using HTTP to read from the local filesystem deserves every bit of pain that they get.
Admin
That said, looking at the "if (strpos($upstr, '.JPG'))" pattern one can not help but wonder if the developer fully understands PHP. strpos() returns FALSE if the string is not found, but 0 if the string is found at position 0. With boolean conversion rules being what they are, a string that starts with '.JPG' would be treated as not containing '.JPG' at all - "if (strpos($upstr, '.JPG') === FALSE)" would probably be better here.
It looks ugly, but sometimes it actually helps, especially if your legacy code is in another language. If your database columns are in french (say, "PlaqueDImmatriculation" for licenceplate) than something like updatePlaqueDImmatriculationWith(newPDI, insuranceNumber) can sometimes be more descriptive.But you should make it an exception, not a rule.
Admin
Admin
Admin
I concur with the spelling of the third parameter. If the final letter is going to be silent anyway, the exact choice is irrelevant.
So "thumb", "thump", "thumt", "thumx", "thumd", "thumg", or "thumk" are all equivalent, right?
Admin
TRWTF is that he "added RegEx" to find the correct files.
Admin
ya beat me to it. Or maybe I just think I remember reading the story... :-)
Admin
Admin
Admin
Surely replacing the function without figuring out what it does counts as a WTF.
Admin
I think you accidently
Admin
TDWTF is usually good for a typo or two, but this article has used up the allotment for the whole week.
Admin
I've also been known to do that sort of lazy strpos when the needle shouldn't occur at the very beginning of the string anyway. It does, of course, mean that you're actually checking "needle is not found in haystack or occurs at the very beginning", but in some cases that's good enough.
You know what would help even more? Not having database column names in French.Admin
Say, that gives me an idea of how to take on the new earth creationists...
"6,000 years old? How can you believe that preposterous figure? The world was demonstrably created 44 years ago on 1/1/70."
Admin
FTFY
Admin
Admin
Admin
C'mon son! The world will be created when you finish reading this sentence.
Admin
I'd love to see the world's Dispose() method.
Admin
Previous save? Too predictable. Corrupt a random save!