Serialize resource

Summary: Fixes #4162

Resources should be serialized as `0` int, or boolean `0` if not a valid resource.

Reviewed By: @JoelMarcey

Differential Revision: D1665854

Signature: t1:1665854:1415336794:f955fc3b238961c2e4096d176525fec593feb335
support for php_serialize fixes #4153

Summary: This resolves #4153
Closes https://github.com/facebook/hhvm/pull/4158

Reviewed By: @sgolemon

Differential Revision: D1664260

Signature: t1:1664260:1415406608:4156e3a93123110a4a71c3fbe79eaa37c54d791c
Sendmail

Summary: Support ```sendmail_path``` in ```php.ini``` and use the standard sendmail path ```/usr/lib/sendmail``` rather than expecting it to be on the user's ```PATH``` which it often isn't.
Closes https://github.com/facebook/hhvm/pull/4138

Reviewed By: @sgolemon

Differential Revision: D1664106

Signature: t1:1664106:1415406718:669cbb275b7e2acdb2d5378f02a850b030cccf53
ocamlbuild build for Hack open source

Summary: This replaces (most of) the open source build for Hack by a much simpler
ocamlbuild-based one.

Main points of interest:
* Build itself is straightforward and looks a lot like the Flow one
* I did NOT do the JS build - just fixed up an existing breakage. Not really sure how to make that one more maintainable
* Updated the test runner so we don't have to list test directories in two places

Reviewed By: @jwatzman

Differential Revision: D1654465

Signature: t1:1654465:1415402598:72396c4eac1cb02aa652b72ae9ff62a701571d22
Convert `else if` to `elseif` in the lexer

Summary: Patterns like the following create deep AST tree and can
potentially overflow our parser's depth limits (See #2699).

  if (expr) {} else if (expr) {} else if (expr() {} else {}

  IfStatement
    IfBranchStatement
    IfStatement
      IfBranchStatement
        IfStatement
          IfBranchStatement
            ...etc...

By interpreting "else"{WHITESPACE}*"if" as T_ELSEIF we're
able to keep such chains flat.

  IfStatement
    IfBranchStatement
    IfBranchStatement
    IfBranchStatement
    ...etc...

Has the very minor side-effect of making token_get_all()
return T_ELSEIF rather than T_ELSE T_WHITESPACE T_IF as expected,
but that should be a matter of academic purity rather than
anything functional.  I look forward to regretting these words.

Closes #2699

Reviewed By: @paulbiss

Differential Revision: D1666431

Signature: t1:1666431:1415344521:9373b9a139c6ece1eff955742d91204ea7ee58bc
Limit ASIO session timeout to request timeout

Summary: We've seen requests get stuck on timedwait's in asio.  It's not
totally clear why they're getting stuck, but regardless it seems that we
shouldn't wait longer than the request timeout for something to return.

Reviewed By: @jano

Differential Revision: D1665567

Signature: t1:1665567:1415390539:e39ea95cfd07bc41781b198c7ef87c36db84fbec
Fix closure var_export

Summary: Just export the name of the class to avoid infinite recursion.

Fixes #4176

Reviewed By: @fredemmott

Differential Revision: D1668260

Signature: t1:1668260:1415405711:bc1f17b7b39fc980cdff4ae8a4637fcdee085784
If there is no socket error, return an empty string

Summary: Right now we return `NULL`. PHP 5.x returns an empty string. Let's be compatible.

Fixes #3066

Reviewed By: @markw65

Differential Revision: D1668138

Signature: t1:1668138:1415410047:7339d837f79e4bda755cf5cbc2d8c716b5635c19
ftell() for sockets shouldn't be supported. So always return 0.

Summary: Right now, for sockets, we return the number of bytes written to the socket when we call
`ftell()`. But this shouldn't be the case.

See ESPIPE ... http://pubs.opengroup.org/onlinepubs/009695399/functions/ftell.html

PHP 5.x returns 0 when calling `ftell()` on a socket, so that's what I propose we doo.

This is a one line change, which can be the scariest. :)

Let me know if I am off base, but this does fix an HHVM OSS issue.

Fixes #3018

Reviewed By: @sgolemon

Differential Revision: D1668651

Signature: t1:1668651:1415413974:5c040e68e2b4ca1f7a206eef6eca35f54eac12b0
Test runner should print correct options to re-run failing tests

Summary: We were just printing `test/run <testname` even if options were provided. This fixes that.

Fixes #3916

Reviewed By: @paulbiss

Differential Revision: D1665442

Signature: t1:1665442:1415498351:98ea82d6286410ea07a28e4c7641bce59848fdd2
Updated the package version in CMakeLists.txt

Summary: This should be `3.4.0` in the 3.4 branch.
Closes https://github.com/facebook/hhvm/pull/4181

Reviewed By: @JoelMarcey

Differential Revision: D1669153

Signature: t1:1669153:1415514126:b9abcf702f328ac51c6ead9966b5d43238d788fe
Move MInstrState from C++ stack to RDS header

Summary: Move MInstrState to be with the other VM registers in the RDS header,
rather than reserving space for it on the native stack in enterTCHelper. This
is one step on the way to allowing arbitrary rsp manipulations during
tracelets. I also removed MInstrState's tvVal and tvResult members since
they've been unused for a while.

Reviewed By: @jasone

Differential Revision: D1665434
Only ignore hashbang line in cli mode

Summary: @​see https://github.com/php/php-src/blob/master/sapi/cli/php_cli.c#L606
Closes https://github.com/facebook/hhvm/pull/4183

Reviewed By: @JoelMarcey

Differential Revision: D1669155

Signature: t1:1669155:1415548679:cbc90bcbd8331cd54018590dab2747f7d6a28813
Improve fix for issue #4111

Summary: Closes https://github.com/facebook/hhvm/pull/4180

Reviewed By: @JoelMarcey

Differential Revision: D1669151

Signature: t1:1669151:1415548684:b89950d6e0f02fa8a4fc4bc0a9b17d4fb5835a07
issue,4156: xml skip white option also skips new lines'\n' charachters a...

Summary: ...s well,By avoiding this php and hhvm now behave the same.
Closes https://github.com/facebook/hhvm/pull/4185

Reviewed By: @JoelMarcey

Differential Revision: D1669156

Signature: t1:1669156:1415548942:aee891116a06f9eedc66c65ca4491785b3e0c443
Fix fribidi dependency includes

Summary: Fribidi depends on glib, but we're not adding the header file include dirs into our paths.  This makes cmake find glib for us.  Without this, the build fails to find glib.h (on gentoo) and halts.
Closes https://github.com/facebook/hhvm/pull/4187

Reviewed By: @JoelMarcey

Differential Revision: D1669177

Signature: t1:1669177:1415549048:7bff25565005cd0ec28326c41e48f561f5061775
Bump package_version

Set to 3.5 on the master branch
Mark version as dev