Don't allow null bytes in path-type arguments

Summary: CVE-2006-7243

Reviewed By: @sgolemon

Differential Revision: D1384585
Delete const_assert macro

Reviewed By: @alexmalyshev

Differential Revision: D1383263
Plausibly fix a race condition in the PhpFile unloading code path

Summary: After a PhpFile's reference count goes to zero, we put it on
the Treadmill, but it's still in the s_md5Files map.  Another thread
might load a file with the same md5 (in computeMd5), and then lead to
incRefing the PhpFile and using it again, and we'll hit the
always_assert in ~PhpFile when the treadmill runs.  Instead, try to
get it out of the md5files map earlier---this isn't quite enough
because another thread could still pull it out, so lookup sites also
need to check if the PhpFile has a non-zero reference count when it
comes out of the s_md5Files map.

Reviewed By: @mxw

Differential Revision: D1383518
Make most of FileRepository private to the cpp

Summary: I think the whole PhpFile thing can also be hidden internally
here if we move three related functions from ExecutionContext
(lookupPhpFile, lookupIncludeRoot, and evalInclude) and make them
return Unit*'s instead.  "Give me the Unit* for a path" seems like a
nicer API, but I'm not 100% sure if I like that route (mainly I'm
worried that the implementation here is too complex to add anything to
immediately---probably it should be simplified first).  I think this
is an incremental improvement worth taking on its own for now, though.

Reviewed By: @mxw

Differential Revision: D1383870
Delete PendQ; convert users to Treadmill

Summary: There were a few uses of this PendQ, which apparently defers
an event until the next request starts on this thread.  This must've
been added before the Treadmill, because the comments about mutex rank
at callsites were wrong now.  Also fix the thread-safety bugs with
ProfileController's orphaned units vector.

Reviewed By: @mxw

Differential Revision: D1383897
Remove unused std::strings m_profName, m_srcRoot from each PhpFile

Reviewed By: @mxw

Differential Revision: D1383904
Make lookupPhpFile and lookupIncludeRoot traffic in Unit* instead of PhpFile*

Summary: All anyone does with PhpFiles these days is get the Unit* out
of it.  (They used to reference count them, but Mark fixed that a
while back, and now it's a bit redundant.)  Trying to get them out of
the m_evaledFilesMap requires more testing (to ensure the keys are the
same as phpFile->getFileName)---maybe later.

Reviewed By: @mxw

Differential Revision: D1383936
Remove unimplemented inclued_get_data builtin

Summary: It doesn't returned any inclued data, and there seems to be
no php documentation about an API with this name.  (Or named
include_get_data for that matter.)  We've apparently had this thing
forever.

Reviewed By: @ptarjan

Differential Revision: D1383945
Some clean up on builtin-functions.{h,cpp} stuff

Summary: Remove a few unused or trivial functions, move autoload
handler to its own header, split the implementation for things that
were only used by autoload, pull some non-public functions out of the heade.r

Reviewed By: @mxw

Differential Revision: D1384138
clownlist flaky phpbb3 tests

Summary: Found via FB CI testing.

Reviewed By: @JoelMarcey

Differential Revision: D1390559
Add definitions for AsyncIterator and AsyncGenerator

Summary: Add hack definitions for AsyncIterator and AsyncGenerator.

Reviewed By: bill

Differential Revision: D1389287
namespace-qualify argument to --show

Summary: Requiring ## \Foo ## is a huge pain, because it must be
 single-quoted in bash. Also changes the help copy for ## --show ##
 to be slightly more accurate: there are no issues with people using it,
 just no scripts.

Reviewed By: julienv

Differential Revision: D1389637
Get rid of headers for region-hot-trace and region-whole-method

Summary: They define one method each, so just fold them into
region-selection.h, which is where the other region selectors are defined.

Reviewed By: smith

Differential Revision: D1390022
Awful bytecode pattern-matcher thing

Summary: I needed something to pattern-match on bytecodes in order to detect and
inline singleton patterns, so here it is.

Reviewed By: jdelong

Differential Revision: D1344595
Try to inline singleton pattern functions

Summary: We see a lot of code roughly of the form

  function getSingletonFoo() {
    static $instance = null;
    if ($instance === null) {
      // Do some stuff and set $instance.
    }
    return $instance;
  }

Let's optimistically assume that such patterns are in fact singleton
patterns (as opposed to, say, some means of inter-method communication
to avoid threading arguments) and try to inline these checks.  The first
time we hit each callsite, we'll side-exit to do the call, and
subsequent calls will simply return the value at $instance, assuming the
checks still pass.

We also introduce a TransFlags struct which we thread through BindJmp
requests and into the translation routines so that we turn the inlining
off in the stub.

Presently, this inlining strategy is restricted to non-resumable
functions with no arguments passed and which don't return refs.

Reviewed By: bertrand

Differential Revision: D1344602
Do not check surprise flags on async function suspend.

Summary: Once AwaitE suspends execution, locals of the current frame are
considered dead. If the surprise flag triggers C++ exception that
unwinds the frame, we incorrectly try to free them.

Let's not check surprise flag until this gets fixed.

Reviewed By: jdelong

Differential Revision: D1391872
Fix relaxation of specialized boxed types

Summary: The main problem exposed by the new test was that the assert in
TypeConstraint::setDesiredClass was too restrictive. While I was fixing that I
noticed that relaxType was losing specialized inner types so I fixed that too
and added a gtest case to catch it.

Reviewed By: ottoni

Differential Revision: D1389525
Fix a bug in evalPHPDebugger

Summary: evalPHPDebugger can be asked to print the results of evaluating php
before the initial frame has ever been entered.  In this case, fp is
null---most of the function was checking this, but a new part forgot to.

Reviewed By: aravind

Differential Revision: D1390724
Add interface to set hhi dir for unit tests

Summary: Nothing terrifically complicated. Just allow setting the ref cell.

Reviewed By: pad

Differential Revision: D1389742
Set environment variables needed for PHP5 mysqli tests on travis

Reviewed By: @ptarjan

Differential Revision: D1388391