• Tinkle (unregistered)

    Now that is taking the fail fast philosophy to another level. Call this fail frist.

  • (nodebb)

    That sounds like the most PHP thing ever

  • Robin (unregistered)

    Where's the "TODO: add real implementation" comment? (Bonus points if that comment was added 5+ years ago. )

  • (nodebb)

    Okay, what type of database API is this where you can just read the PHP code? Normally you'll make a C/C++ wrapper whose sole purpose is to create functions you can call from PHP.

    The only excuse I could give is the real backend API doesn't support locking directly (Connection library doesn't have a function for it, or it was added after the PHP extension was made), and you need to write the locking code yourself in raw SQL. If this is the case, that would explain things a little, and the dev who wrote the function didn't look up the SQL code yet.

  • (nodebb)

    Maybe the particular database does not support any type of locking. The procedure would then be correct. The database would be a much bigger WTF though.

  • (nodebb)

    The rest of you see a problem. All I see is a great timesaver: no need to spend hours trying to understand obfuscated code or test anything.

  • Richard Brantley (unregistered)

    Didn't we have a story last week where the code contained the comment "ran out of budget?" Did the same thing happen here?

  • (nodebb) in reply to nerd4sale

    I think you're right.

    But from where I am, this is a clumsy way of doing it.

    I understand that this is some multi DB API written in PHP. While I don't know what can and cannot be done in PHP per se, I would probably have tried to 1) add some way to query the API for what functionality it supports and 2) thrown an exception in this method. (1 would help any higher level methods in the API from running into exceptions...)

    Because, as the OP indicates, they now had to spend time figuring out what was going on when the implementer could have given them that info up front. But maybe exceptions works differently in PHP... I'm willing to bet they do... (So maybe TRWTF is PHP? ;o)

  • (nodebb) in reply to Richard Brantley

    No budget was procured to begin with.

Leave a comment on “All Locked Up”

Log In or post as a guest

Replying to comment #682054:

« Return to Article