htmlentities() should output valid ISO-8859-1 characeters to appropriate entities

Summary: Right now, when we call `htmlentities()`, we only output appropriate entities for
any ISO-8859-1 character below 0x80. Anything above, we output the empty string "".
But there is a range from 0xA0 to 0xFF that can have entities that should be output as
well.

Fixes #2186

Reviewed By: @paulbiss

Differential Revision: D1675303

Signature: t1:1675303:1415936937:4d6f5b6d74e80d7a527940b5308e4c0c9926bb24
Add missing argument to DOMXPath::{query,execute}()

Summary: These functions now take a third argument to bypass automatic context
registration. The fix is basically exactly what PHP 5 does with this argument.

Fixes #2810

Reviewed By: @JoelMarcey

Differential Revision: D1680720

Signature: t1:1680720:1415940166:d499bfa1576bfbdd54465b41f32a37fdca4e784c
Skip unreachable blocks in IRBuilder::reoptimize()

Summary: Unreachable blocks may contain instructions with inconsistent operand
types, but such blocks may not be eliminated until reoptimize turns
conditional jumps into unconditional ones.  So we need to make
reoptimize work in such scenarios, and this diff accomplishes this by
keeping track of which blocks are reachable during reoptimize, and
then skipping the unreachable ones.

I was able to repro this with the new test case, but I had to hack the
profile-based ArrayGet specialization to stress test it.  So I'm
adding a runtime option to for that.

Reviewed By: @jdelong, @alexmalyshev

Differential Revision: D1680327
Shrink StringData::m_cap to 24 bits to make room for kind

Summary: Use the packedCap trick to reduce StringData's cap field.
Fixes a bug in smartMallocSize() where the debugHeader recorded
the requested capacity instead of the returned capacity.

Reviewed By: @jdelong

Differential Revision: D1646907
Add zlib.output_compression ini option

Summary: We had `zlib.output_compression_level`, but that should only be used if
`zlib.output_compression` is set to "On". Add this option.

This doesn't perform the gamut of the option, but it is a start. I have a TODO
to add more functionality for the option.

http://docs.hhvm.com/manual/en/zlib.configuration.php

Fixes #3744

Reviewed By: @paulbiss

Differential Revision: D1677334

Signature: t1:1677334:1415931492:a151c55a03ccb03b83efc54107f598e9b01150e3
Fix getOldestStartTime

Summary: There was a tiny possibility that apc entries would be
freed immediately, even though they were still in use by a request, because
getOldestStartTime could return a value 1 greater than it should have done.

Reviewed By: @alexmalyshev, @jasone

Differential Revision: D1679072

Signature: t1:1679072:1415898450:3de211d0b25623b01c3018fe99fb0a9ae6be2fe5
Error when using "shape" as a type

Summary: At least one person tried to do this.

Fixes https://github.com/facebook/hhvm/issues/3170

Reviewed By: @int3

Differential Revision: D1674539

Signature: t1:1674539:1415945723:4dc8265faf91bc34b239b78d9b2e8d113611ce84
Conversion for AT composites

Summary: Kinda ugly, but since there aren't too many composites this
will do.

Reviewed By: @ptarjan

Differential Revision: D1673940

Signature: t1:1673940:1415958643:ea838fbb8c51b9645f90d73b2ac356df69449ee4
Weaken assert in FileUtil::canonicalize

Summary: If a URL has trailing %00's we'd convert those to null but count them
as part of the length.  There's no vulnerability here since the actually string
length would actually be less than we thought.  So the assertion is too strong
as written.

Reviewed By: @ptarjan

Differential Revision: D1485497
Fix PHP primitive default parameter type check

Summary: Allow primitive default values for parameters with primitive type hints

Reviewed By: @paroski

Differential Revision: D1668186
Add magic quotes to NEWS file

Summary: This is a BC break so should really be in NEWS.

Reviewed By: @JoelMarcey

Differential Revision: D1682085

Signature: t1:1682085:1415992796:591c354c4a2330828c74fd91b005b0c19dcfdf50
Explicitly declare PDOStatement::queryString

Summary: nullable string since that's how PHP5's PDOStatement initializes it.

Closes #1856

Reviewed By: @JoelMarcey

Differential Revision: D1680507

Signature: t1:1680507:1415924741:84e7c35a840e03d4f2221727e029822837876aee
Fix optional 'errorcode' parameter is not set up properly

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

Reviewed By: @JoelMarcey

Differential Revision: D1672902

Signature: t1:1672902:1416001499:97856f2a1dc665cfde057ae1eb7c7f1023098706
Change exit(-1) to exit(EXIT_FAILURE) in hphp

Summary: Changing exit(-1) to exit(EXIT_FAILURE) across fbcode

Reviewed By: @markw65

Differential Revision: D1648402
Remove Pos.file.

Summary: Explicit is better than implicit!

Reviewed By: @jwatzman

Differential Revision: D1677963

Signature: t1:1677963:1415907499:8acc4d937267fb9e4caf573ae541b2d22c5d5fe4
Use a non-worker thread for the job reaper

Summary: Reaping timed-out jobs used to use a worker thread, which causes the
treadmill to back up.  This makes the reaper a dedicated thread, so it doesn't
hold up the treadmill.

Reviewed By: @jdelong

Differential Revision: D1660353
Use musttail to enforce tail call.

Summary: From LLVM manual: "The musttail marker means that the call must be tail call optimized in order for the program to be correct". We should use it when we need tail call to happen.

Reviewed By: @jasone

Differential Revision: D1682217

Signature: t1:1682217:1415995606:133db7fff792a61fb7c199febbe4e31eea8d1ea3
Copy-and-clear instead of detaching JSON StringBuffer

Summary: detach transfers ownership of the buffer to a String; but during JSON
decoding we always start with a 127-character buffer, so short strings end up
wasting a bunch of memory.  Copying gives us tightly allocated strings, and
clear just resets the internal length to zero, so we don't have to allocate a
new buffer.

Reviewed By: @markw65

Differential Revision: D1681172

Signature: t1:1681172:1415990188:2851b963a32ef54861557000bd229e3041ef9e05
Simplify how `hh_client` finds the root

Summary: This used to do very different things depending on if you
specified a root to `hh_client` or not, including different error
messages. I think it makes sense for it to climb up the directory
hierarchy same as if you don't specify a root (see github task), and it
also makes the code cleaner.

Fixes https://github.com/facebook/hhvm/issues/3643

Reviewed By: @int3

Differential Revision: D1682933

Signature: t1:1682933:1416006291:3bf378e5a19598d587e35371f909e064067326dd
unparse dynamic new

Summary: We currently parse new as id*exprlist*exprlist so we can represent
dynamic new only as new *Unknown*. This diff parses it as expr * expr list * expr list
and converts it back into an id during naming

Reviewed By: @paroski

Differential Revision: D1674986

Signature: t1:1674986:1416011812:ddac5e57292e9f7f135d5d502818b0d64cd30eb4