Hacker News new | ask | show | jobs
by wazoox 42 days ago
This didn't happen to me... yet. Here's what I found 2 days ago deep in a production PHP codebase:

  private static function createUUID(){
   $md5 = md5(uniqid('', true));
   return substr($md5, 0, 8 ) . '-' .
    substr($md5, 8, 4) . '-' .
    substr($md5, 12, 4) . '-' .
    substr($md5, 16, 4) . '-' .
    substr($md5, 20, 12);
  }
Holy cow, how didn't this horror come and bite us in the juicy parts ? I don't know.