67
myss
7y

Ex-coworker of mine fixed this bug a week after the site was launched and has gathered several thousand users in database.

Yep its exactly what you think it is, each time one user would update its infos, it would update his infos to all the users in the database.

Luckily I was not in charge of the project in that time, so it was really fun to watch how everyone's name was changing every couple of minutes for a whole week :D

Comments
  • 24
    *FACEPALMS OUT OF THE UNIVERSE*
  • 3
    Why the raw sql strings..

    Only case I've come across it being worthwhile with it, was In performance critical environments..
    But in those environments, php isn't really a considerable option.. *cough* threading..

    Maybe in 7.2 with pthreads.
  • 31
    WAIT! THAT WASN'T NOTICED FOR A WEEK?
  • 4
    wow, password and all..
    so the last user that logs in gets a "welcome, all users"
  • 12
    @PrivateGER
    First day or two it wasn't noticable because nobody updated their profile.

    When one person did it the avalanche effect started and everyone was updating their infos cause they were obviously wrong..

    After geting a report of a problem, he spents two days checking and dumping the output cause he thought he's somehow retrieving or printing wrong data (from another user).

    He then decided to take a look at the production database and found out what's happening.

    Then it took him whole day of digging through his code to find the problem while casually replacing his typos, indentations, whitespaces, blanks lines etc. Pretty sure he made this on purpose so if anybody goes to his commit in future, they don't spot the fuckup so easily.

    Than the weekend came and in Monday he asks me to deploy the changes manually via webhook and pull out RDS snapshot from Amazon saying the problem is finally fixed.

    And what's the funiest of all his commit message on git was "minor fixes"..
  • 0
    @lotd Yeah but by his oppinion "the api wasn't so complex", so it was better to just create it in vanilla php than introducing micro frameworks and orm..
  • 0
    @myss
    There seems to be a framework. Probably yii2
    I would use raw SQL with it only if there are any complex queries due to performance. Other than that , framework is just fine
  • 1
    @myss guess he haven't tried a good solid orm, yet.. :p
  • 0
    I'm not used to raw queries in PHP at all, but I can't see the problem here.
    The "where" condition is given, the binding was made the same way for others params...
    So, what am I missing? :/
  • 3
    @myss since everybody thought it was better to downvote my question rather than giving an answer, can you please explain me what is wrong here?
  • 1
    @LurkingAround Take a look at the image again. The problem was in the first, red line. This was replaced by green lines later. It's just a screenshot from diff comparison between two git commits..
  • 3
    @myss I didn't understand your comment the right way. I understood your colleague fixed a previous bug (the red one), committing a new one.

    I was looking for the error in the green one. Now I get it ^^

    Thanks for taking your time and giving an answer, despite the one's who just simply downvoted.
    And then they have the guts to say that SO user's are assholes..... :/
Add Comment