• PJH (cs)

    I'm fairly certain that the second parameter to strip_tags() shouldn't be a few blank lines...

  • moz (unregistered)

    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?

  • Bobby Tables (cs) in reply to PJH

    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.

  • Whackamole (unregistered)

    $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?

  • DES (cs) in reply to moz
    moz:
    I'm not sure I quite understand the last line, though. "Remember"? Does someone else need to learn about HTML comments?

    Total Recall is based on a short story by Philip K. Dick named “We Can Remember It For You Wholesale”.

  • waltersko (unregistered) in reply to moz
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

  • RFox (unregistered) in reply to waltersko
    waltersko:
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

    ...+1 yeah it's short for thumpnails

  • foo AKA fooo (unregistered) in reply to PJH
    PJH:
    I'm fairly certain that the second parameter to strip_tags() shouldn't be a few blank lines...
    Don't be too hard on them. So they messed up HTML quoting. It happens sometimes. The last time this happened here was 2014-02-10. So cut them some slack. Nobody's perfect.

    (You can delete this comment now, like yesterday.)

  • foo AKA fooo (unregistered) in reply to RFox
    RFox:
    waltersko:
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

    ...+1 yeah it's short for thumpnails

    Yeah, how stupid! It's knot even pronounced like a "p".
  • faoileag (unregistered) in reply to foo AKA fooo
    foo AKA fooo:
    RFox:
    waltersko:
    moz:
    But the unused parameter is called $thumps.
    German developer with intermediate language skills.
    ...+1 yeah it's short for thumpnails
    Yeah, how stupid! It's knot even pronounced like a "p".
    To some, the idea of a silent vowel inside a word is indeed a novel concept.
  • ¯\(°_o)/¯ I DUNNO LOL (unregistered)

    TRWTF is that Curtis forgot to rename the function to real_getpictures().

  • waltersko (unregistered) in reply to foo AKA fooo
    foo AKA fooo:
    RFox:
    waltersko:
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

    ...+1 yeah it's short for thumpnails

    Yeah, how stupid! It's knot even pronounced like a "p".

    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"

  • faoileag (unregistered) in reply to waltersko
    waltersko:
    foo AKA fooo:
    RFox:
    waltersko:
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

    ...+1 yeah it's short for thumpnails

    Yeah, how stupid! It's knot even pronounced like a "p".

    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"

    "This is why you have chest pain" said Gertrude, applying her thumps to Hanzo's back, provoking a shriek of pain from the IT department's go-to man.

  • Simon Clarkstone (unregistered) in reply to RFox

    "...+1 yeah it's short for thumpnails"

    Well, when all you have is a hammer...

  • Fritz, a.k.a. Fritzo (unregistered)

    Was this article written by Google Translate?

  • Fritz, a.k.a. Fritzo (unregistered) in reply to RFox
    RFox:
    waltersko:
    moz:
    But the unused parameter is called $thumps.

    German developer with intermediate language skills.

    ...thumps up yeah it's short for thumpnails

    FTFY a.k.a. FTFYO

  • EvilSnack (unregistered)

    "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?

  • bluesman (unregistered)

    Everybody knows try...catch... blocks are only for debugging purposes, so at least that was done right.

  • moz (unregistered) in reply to DES
    Comment held for moderation.
  • faoileag (unregistered) in reply to bluesman
    bluesman:
    Everybody knows try...catch... blocks are only for debugging purposes, so at least that was done right.
    Exactly. It is a far better user experience if the system crashes without warning, taking all the data you painstakingly had entered during the last fifteen minutes with it.

    The suspense when you are finally about to hit the "save" button... Alfred Hitchcok himself couldn't have done better!

  • Bruce Johnson (unregistered) in reply to moz

    And if a joke has to be explained, it couldn't have been that funny to begin with. Sigh.

  • MrBester (unregistered) in reply to Bruce Johnson
    Bruce Johnson:
    And if a joke has to be explained, it couldn't have been that funny to begin with. Sigh.
    Funny is in the eye of the beholder. Similarly, if the humour is too advanced for a feeble brain it will need explaining, thus draining it of amusement value to both parties.

    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.

  • faoileag (unregistered) in reply to Bruce Johnson
    Bruce Johnson:
    And if a joke has to be explained, it couldn't have been that funny to begin with. Sigh.
    But it wasn't a joke, it was an in-joke.

    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.

  • Bobby Tables (cs) in reply to faoileag
    faoileag:
    Bruce Johnson:
    And if a joke has to be explained, it couldn't have been that funny to begin with. Sigh.
    But it wasn't a joke, it was an in-joke.

    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.

    +42

  • dkf (cs) in reply to faoileag
    faoileag:
    Exactly. It is a far better user experience if the system crashes without warning, taking all the data you painstakingly had entered during the last fifteen minutes with it.

    The suspense when you are finally about to hit the "save" button... Alfred Hitchcok himself couldn't have done better!

    Go one better; make it corrupt the previous save at the same time! Hours of fun for everyone!

  • Anonymoose (unregistered)

    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.

  • anonymous (unregistered)
    Comment held for moderation.
  • PJH (cs) in reply to anonymous
    anonymous:
    TRWTF is that you can even fopen($directoryurl, "r") and expect to get anything valid...

    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.)

  • faoileag (unregistered) in reply to PJH
    Comment held for moderation.
  • anonymous (unregistered)

    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.

  • anonymous (unregistered) in reply to faoileag
    Comment held for moderation.
  • faoileag (unregistered) in reply to anonymous
    anonymous:
    Ausgabe? Die muttersprache!
    "rest" probably qualifies for that as well - if I understand the code good enough, "remainder" or "stuffbeyondext" would be more descriptive.

    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.

    anonymous:
    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.
    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.

  • nerd4sale (cs) in reply to faoileag
    But you should make it an exception, not a rule.
    You could make it a rule of thump.
  • C-Derb (unregistered) in reply to Fritz, a.k.a. Fritzo
    Fritz:
    Was this article written by Google Translate?
    +5, Fritzo. Alex, go ahead and splurge. Hire an editor.
    Bruce Johnson:
    Where consultants looked into the nooks and crannies of an application, peering into crevices not visited since the dawn of time (that is 1/1/70).
    Bruce Johnson:
    It's not nice to criticize the try/catch block that didn't seem to do my, because it has been commented out.
    Bruce Johnson:
    If you look closely, you'll notice that the list of files is process in 4K chunks.
    Bruce Johnson:
    Which, by pure 'luck', is the reason why the entries weren't being retrieved properly in the first.
    Bruce Johnson:
    And implementing it took less time then it did to figure out what this monstrosity was actually supposed to be doing.
  • Harrow (unregistered)

    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?

  • anon (unregistered)

    TRWTF is that he "added RegEx" to find the correct files.

  • cellocgw (cs) in reply to DES
    DES:
    moz:
    I'm not sure I quite understand the last line, though. "Remember"? Does someone else need to learn about HTML comments?

    Total Recall is based on a short story by Philip K. Dick named “We Can Remember It For You Wholesale”.

    ya beat me to it. Or maybe I just think I remember reading the story... :-)

  • cellocgw (cs) in reply to Simon Clarkstone
    Simon Clarkstone:
    "...+1 yeah it's short for thumpnails"

    Well, when all you have is a hammer...

    ... you're still one-up on the poor sod who has no tools at all.

  • nitePhyyre (unregistered) in reply to Harrow
    Harrow:
    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?

    +1
  • not the guy (unregistered)

    Surely replacing the function without figuring out what it does counts as a WTF.

  • Anon (unregistered)
    Which, by pure 'luck', is the reason why the entries weren't being retrieved properly in the first.

    I think you accidently

  • Anon (unregistered) in reply to C-Derb
    C-Derb:
    Fritz:
    Was this article written by Google Translate?
    +5, Fritzo. Alex, go ahead and splurge. Hire an editor.
    Bruce Johnson:
    Where consultants looked into the nooks and crannies of an application, peering into crevices not visited since the dawn of time (that is 1/1/70).
    Bruce Johnson:
    It's not nice to criticize the try/catch block that didn't seem to do my, because it has been commented out.
    Bruce Johnson:
    If you look closely, you'll notice that the list of files is process in 4K chunks.
    Bruce Johnson:
    Which, by pure 'luck', is the reason why the entries weren't being retrieved properly in the first.
    Bruce Johnson:
    And implementing it took less time then it did to figure out what this monstrosity was actually supposed to be doing.

    TDWTF is usually good for a typo or two, but this article has used up the allotment for the whole week.

  • anonymous (unregistered) in reply to faoileag
    faoileag:
    anonymous:
    Ausgabe? Die muttersprache!
    "rest" probably qualifies for that as well - if I understand the code good enough, "remainder" or "stuffbeyondext" would be more descriptive.

    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

    I've used "rest" to mean "remainder". It's shorter, and it basically means the same thing.

    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.

    faoileag:
    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.
    You know what would help even more? Not having database column names in French.

  • mara (unregistered)
    ...dawn of time (that is 1/1/70).

    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."

  • QJo (unregistered) in reply to cellocgw
    Comment held for moderation.
  • anonymous (unregistered) in reply to mara
    mara:
    ...dawn of time (that is 1/1/70).

    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."

    Bollocks. The earth was created in its present state five seconds before I started typing this post.

  • Loose Bree (cs) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    TRWTF is that Curtis forgot to rename the function to real_getpictures().
    Of course! Everyone knows the prefix "real" is a warning of deep WTFery.
  • Shill (unregistered) in reply to anonymous
    anonymous:
    mara:
    ...dawn of time (that is 1/1/70).

    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."

    Bollocks. The earth was created in its present state five seconds before I started typing this post.

    C'mon son! The world will be created when you finish reading this sentence.

  • chubertdev (cs) in reply to Shill
    Shill:
    C'mon son! The world will be created when you finish reading this sentence.

    I'd love to see the world's Dispose() method.

  • chubertdev (cs) in reply to dkf
    dkf:
    faoileag:
    Exactly. It is a far better user experience if the system crashes without warning, taking all the data you painstakingly had entered during the last fifteen minutes with it.

    The suspense when you are finally about to hit the "save" button... Alfred Hitchcok himself couldn't have done better!

    Go one better; make it corrupt the previous save at the same time! Hours of fun for everyone!

    Previous save? Too predictable. Corrupt a random save!

Leave a comment on “Total Recall: The Directory's Cut”

Log In or post as a guest

Replying to comment #:

« Return to Article