Live data from Hacker News

Facebook PHP Source Code from August 2007

gist.github.com

111–120 of 154 posts

Re: Facebook PHP Source Code from August 2007

#111
post #62

Earlier quoted context omitted.

It is certainly not still there given that facebook doesn't run PHP any more. They wrote a compiler to translate a subset of PHP to C++, which they then compiled into a massive executable. The compiler is open source and called hiphop, and it does not implement the PHP memory limits.

Facebook still uses PHP bro...

They still write code in the language PHP. They do not run that code using PHP the software you download from php.net. The memory limits of the PHP interpreter from php.net are not relevant at all to facebook's current operations.

Re: Facebook PHP Source Code from August 2007

#112
post #100
post #62

Earlier quoted context omitted.

It is certainly not still there given that facebook doesn't run PHP any more. They wrote a compiler to translate a subset of PHP to C++, which they then compiled into a massive executable. The compiler is open source and called hiphop, and it does not implement the PHP memory limits.

They don't do that anymore. Ask your Facebook friends, hphp has changed since then.

I know, I used past tense. But the initial hiphop work was when php memory limits stopped being relevant for them.

Re: Facebook PHP Source Code from August 2007

#113
post #62

Earlier quoted context omitted.

It is certainly not still there given that facebook doesn't run PHP any more. They wrote a compiler to translate a subset of PHP to C++, which they then compiled into a massive executable. The compiler is open source and called hiphop, and it does not implement the PHP memory limits.

By that logic, no one runs any programming languages, since they all get translated to x64 or other instruction sets.

That makes no sense at all. The function in question sets the memory limit for the PHP interpreter. A specific piece of software. Facebook does not use that specific piece of software.

Re: Facebook PHP Source Code from August 2007

#114
post #109

Earlier quoted context omitted.

I guess shipping is more important to you than the possibility of losing user details (or worse). Christ, I hope I never give my details to a company you found. Shipping quickly is important but it's also important to write quality code. Small bugs that can easily be fixed are fine but security problems or bugs related to payments, for example, are not.

How many companies have failed because of security flaws in their code?

Companies don't normally fail because of security flaws, in the same way Boeing doesn't go bust when it has to ground 787s. But in both cases you end up potentially taking a huge hit in costs. Off the top of my head, Sony had to write down $170 million in costs when PSN was compromised, and TJ Maxx ended up paying out $800 million in costs, damages, and compensation after their payment terminals leaked credit card details.

These are not figures you want to see on your bottom line.

Re: Facebook PHP Source Code from August 2007

#115
post #54
post #31

Earlier quoted context omitted.

It'd be somewhat weird to stumble across comments in that code. // TODO:

I quite often see words (or nearly-words) in protein sequences. The best I've seen are (when reading DNA translated in all frames): EVQLVE LAMARCK ELVISISGAY SALTYSATAN

http://dresdencodak.com/2009/07/12/fabulous-prizes/

Re: Facebook PHP Source Code from August 2007

#116
post #74

Earlier quoted context omitted.

Cool, i remember these days as well. Indeed it very much looked like StudiVZ just used FBs css filed and changed some colors.. It was a typical german clone success story. Dariani did a lot of questionable things but sold in the right time before the downfall of VZ. I didnt really like it, they basically did nothing in terms of innovation that FB did, it had the same features for years. Later they had a half-assed ap…

We had to solve scaling issues most of the time. VZ was running on a multi-tier platform with services written in Java, PHP, Erlang, C++ and Python. 17 million users with around 25 billion requests per month (without static content)... Some numbers from 2010: - 60.000 req/s (without static content) - 2.5 mio. memcache ops/s - 300k queries to the database tier We've built that platform with a team of around 20-30 engi…

I think Facebook had the same problems. Maybe a bit bigger ;)

Re: Facebook PHP Source Code from August 2007

#117

I remeber these days. I worked at this time for studiVZ - a german social network (still exist, but nobody is using it anymore) and this leaked was caused by a misconfiguration in their Apache setup. In 2008 studiVZ was sued by Facebook. They said we theft their PHP, CSS/JS "code". ( http://techcrunch.com/2008/07/18/facebook-sues-german-social... ). Indeed, the first version of studiVZ was inspired by Facebook. Our f…

Just curious, what social networks are popular in Germany now? And what led to the declining usage of studiVZ?

Re: Facebook PHP Source Code from August 2007

#118
post #50

Earlier quoted context omitted.

I wonder if it was based on the code Zuckerberg used for the Java friend graph he had on his homepage prior to Facebook. Could you perhaps censor the credentials and release it?

I am not a lawyer, but even with censored credentials this seems like a bad idea. Especially since my profile is not exactly anonymous. Any Facebook employees want to get me a green light? :)

uptil I looked at the receipt which had said $9272, I didn't believe that my mom in-law woz realie bringing in money in there spare time on there computar.. there friends cousin haz done this 4 only about eighteen months and recently cleard the mortgage on their place and bourt a great opel. additional info ==========================

http://WWW.WORKS23.COM

Re: Facebook PHP Source Code from August 2007

#119
People just call this spaghetti for superficial reasons, they don't see objects and they don't see current PHP practices used in 2013. But it is readable and maintainable code. We're out of context, and there is nothing there to assume lack of quality. Some people mistake code with literature, objectively speaking this is not bad code.

Re: Facebook PHP Source Code from August 2007

#120
The code looks pretty clean. I dig the two-tab spacing as well, but perhaps that was done after the fact.

Anyhow, not sure if this makes any difference or not but i'm curious as to why true PHP constants are not used, and instead regular variables in all caps like $PARAM_INT are used. Anyone know why this might be?

I ask because one of you PHP-gurus might inform me that there are certain use-cases where a true constant is not wise.

An example below:

  param_get_slashed(array(
    'feeduser' = > $PARAM_INT, //debug: gets feed for user here
    'err' = > $PARAM_STRING, // returning from a failed entry on an orientation form
    'error' = > $PARAM_STRING, // an error can also be here because the profile photo upload code is crazy
    'ret' = > $PARAM_INT, 'success' = > $PARAM_INT, // successful profile picture upload
    'jn' = > $PARAM_INT, // joined a network for orientation
    'np' = > $PARAM_INT, // network pending (for work/address network)
    'me' = > $PARAM_STRING, // mobile error
    'mr' = > $PARAM_EXISTS, // force mobile reg view
    'mobile' = > $PARAM_EXISTS, // mobile confirmation code sent
    'jif' = > $PARAM_EXISTS, // just imported friends
    'ied' = > $PARAM_STRING, // import email domain
    'o' = > $PARAM_EXISTS, // first time orientation, passed on confirm
    'verified' = > $PARAM_EXISTS)); // verified mobile phone
Post reply on HN