Invalid input == blank



  • I wanted to contribute to an open-source project and was advised to contact one of its two main developers through Github. No clue was provided about which one to prefer, so I thought to send a message to both of them. Github provided no obvious way to send a message to multiple recipients; well, maybe it supports separating recipients with semicolons or commas? Turns out it didn't. However, instead of telling me I'd entered an invalid recipient, it said: "Failed to save because to can't be blank." I'd have expected something about the input containing invalid characters or the user being nonexistent, but how their code manages to treat invalid input as the same as no input is a bit beyond me.



  • Could it be that that page was written by a programmer who is as dense as most programmers are? I spent 15 years in the slime of other people's code. I know how they write code.



  • @SilentRunner said:

    Could it be that that page was written by a programmer who is as dense as most programmers are? I spent 15 years in the slime of other people's code. I know how they write code.

    I hate people too.



  • @Zemm said:

    @SilentRunner said:
    Could it be that that page was written by a programmer who is as dense as most programmers are? I spent 15 years in the slime of other people's code. I know how they write code.
    I hate people too.

    I lol'd.  :)

    In SilentRunner's defense, I would also harbor massive resentment if I was stuck maintaining other people's code for 15 years.  Because most code sucks, especially when it isn't yours.



  • @SilentRunner said:

    For some day sons and daughters
    Will rise up and fight while we stood still

    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?



  • @veggen said:

    @SilentRunner said:
    For some day sons and daughters Will rise up and fight while we stood still
    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?
    That pesky OCD kicking in again, I see?



  • @C-Octothorpe said:

    @veggen said:

    @SilentRunner said:
    For some day sons and daughters Will rise up and fight while we stood still
    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?
    That pesky OCD kicking in again, I see?


    Optical.... Character... D....?
    Oh, you mean OCD, well yeah... pretty much...



  • @veggen said:

    @SilentRunner said:
    For some day sons and daughters
    Will rise up and fight while we stood still

    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?

    I think "will rise up and fight when we stood still" is the intended message. Right now we are still, contrasting that to the fight of the next generation. Or maybe "where we stood still". Yeah, that one sounds better.

    Hmm, further, a clever poet could make an interesting turn of the phrase "taking a stand". Any takers?



  • @Xyro said:

    @veggen said:
    @SilentRunner said:
    For some day sons and daughters
    Will rise up and fight while we stood still

    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?

    I think "will rise up and fight when we stood still" is the intended message. Right now we are still, contrasting that to the fight of the next generation. Or maybe "where we stood still". Yeah, that one sounds better.

    Hmm, further, a clever poet could make an interesting turn of the phrase "taking a stand". Any takers?

    WELL NO MORE shall we stand still; as our forefathers did, in the face of bad writing! Let us rise, brethren, sistren and inbetweenren against the capitalist oppression of imperfectly styled calls to action against alleged future past indifference, which is in fact NOW! Every well-placed hyphen — a grenade in the face of the capitalist oppressor! Each apostrophe's correct usage — a bullet in the heart of the tyrannical west! We shall take to the streets, with tenses as our rifles, armed with commas in our teeth, as the apostrophes are raining from the sky!



  • I think this is a world record off-topic thread, kudos everybody!



  • @veggen said:

    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?

    It's a song quote, you know. Also, I mess up tenses in English a lot, but it always seemed alright to me. "One day they will rise up, while we stood still back when it all started". One part talking about future, other about past, neither of the present.



  • @bannedfromcoding said:

    @veggen said:
    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?

    It's a song quote, you know. Also, I mess up tenses in English a lot, but it always seemed alright to me. "One day they will rise up, while we stood still back when it all started". One part talking about future, other about past, neither of the present.

    How can something happen in the future while something happened in the past?



  • @Xyro said:

    @bannedfromcoding said:
    @veggen said:
    I know it's off-topic, but there's a serious problem with verb tenses in your signature. Maybe it should be "will rise up and fight while we stand still"?

    It's a song quote, you know. Also, I mess up tenses in English a lot, but it always seemed alright to me. "One day they will rise up, while we stood still back when it all started". One part talking about future, other about past, neither of the present.

    How can something happen in the future while something happened in the past?

    One day you will understand, while a few minutes ago you didn't.



  • @fennec said:

    One day you will understand, while a few minutes ago you didn't.

    Hrm, my wrongness sense is tingling... I better look this one up...
    @Wiktionary said:

    Conjunction

    1. During the same time that.
      He was sleeping while I was singing.
    2. although
      This case, while interesting, is a bit frustrating.
    3. (Northern England, Scotland) until
      I'll wait while you've finished painting.
      I may be conveyed into your chamber; I'll lie under your bed while midnight. — Beaumont and Flanders.

    Oh. Definition two, yes, that makes sense. My head's all chronologically oriented today.


    For some day sons and daughters
    Will rise up and fight although we stood still

    Much better!


  • @tdb said:

    how their code manages to treat invalid input as the same as no input is a bit beyond me.

    //strip invalid characters
    input = preg_replace(input, "*;*", "");
    input = preg_replace(input, "*'*", "");
    //etc...
    


  • @lolwtf said:

    @tdb said:
    how their code manages to treat invalid input as the same as no input is a bit beyond me.

    //strip invalid characters
    input = preg_replace(input, "*;*", "");
    input = preg_replace(input, "*'*", "");
    //etc...
    

    My input consisted of two valid usernames separated by a semicolon. Stripping all invalid characters should have left a nonempty string of valid characters, although it probably wouldn't match any existing user.

    Also, your regexes are invalid. * means "repeat previous atom zero or more times", and can't occur as the first character of a regex. You might have meant to use globbing patterns, where * is a wildcard meaning any number of any characters, in which case those patterns would replace the entire input with an empty string if it contains any invalid character. Both regexes and globs support bracket expressions to match any of a specific sets of characters though; the sequence of replace calls is only necessary with plain, non-pattern replaces.



  • @tdb said:

    @lolwtf said:
    @tdb said:
    how their code manages to treat invalid input as the same as no input is a bit beyond me.

    //strip invalid characters
    input = preg_replace(input, "*;*", "");
    input = preg_replace(input, "*'*", "");
    //etc...

    My input consisted of two valid usernames separated by a semicolon. Stripping all invalid characters should have left a nonempty string of valid characters, although it probably wouldn't match any existing user.

    Also, your regexes are invalid. * means "repeat previous atom zero or more times", and can't occur as the first character of a regex. You might have meant to use globbing patterns, where * is a wildcard meaning any number of any characters, in which case those patterns would replace the entire input with an empty string if it contains any invalid character. Both regexes and globs support bracket expressions to match any of a specific sets of characters though; the sequence of replace calls is only necessary with plain, non-pattern replaces.

     

    I think that's the point lolwtf was trying to make- the mistake you rightly point out is how their code treats invalid input as no input while trying to just strip invalid characters. The "series of character replacements" is a clbuttic anti-pattern.



  • @Xyro said:

    @fennec said:
    One day you will understand, while a few minutes ago you didn't.

    Hrm, my wrongness sense is tingling... I better look this one up...
    @Wiktionary said:

    Conjunction

    1. During the same time that.

      He was sleeping while I was singing.

    2. although

      This case, while interesting, is a bit frustrating.

    3. (Northern England, Scotland) until

      I'll wait while you've finished painting.
      I may be conveyed into your chamber; I'll lie under your bed while midnight. — Beaumont and Flanders.

    Oh. Definition two, yes, that makes sense. My head's all chronologically oriented today.


    For some day sons and daughters
    Will rise up and fight although we stood still

    Much better!

    Hmmm, I think that changes the semantics a little. And is not as poetic. Anyway, I get the "while" and tenses now. It actually sounds quite logical...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.