Don't save a block's FrameState in FrameState::update

Summary: It's already saved in IRBuilder::finishBlock, so this was redundant.

Reviewed By: @bertmaher

Differential Revision: D1425693
Adjust the encoding m_pos uses when pointing past the last element

Summary: This diff changes the way arrays encode m_pos when it points past the last
element. Before, ArrayData::invalid_index (-1) was used. This diff changes
it to uses a non-negative value that is greater than the position of the
last element (if there is a last element). This allows PackedArrays and
MixedArrays to set m_pos to 0 initially, and then they never need to update
m_pos when a new element is added.

Reviewed By: @edwinsmith

Differential Revision: D1384311
Create abstraction for things that can block on WaitHandles

Summary: Create abstraction for dependency graph that can include nodes that are
not WaitHandles. Introduce the following data structures:

- AsioBlockableChain, a structure to be embedded in the child, stores
  head of the linked list of parents
- AsioBlockable, a structure to be embedded in the parent, stores
  pointer to the next node in the linked list

This will be used by AsyncPoll, which will embed multiple AsioBlockables
(one per each dependency to be polled).

Reviewed By: @billf

Differential Revision: D1425998
Always save the state for the current block before switching to new one

Summary: In a diff I'm working on, I was hitting an assert in ##IRBuilder::insertLocalPhis## because the FrameState for a block hadn't been saved. Inspecting the code, I found this place where the FrameState for a block wasn't being saved before switching to another block.

Reviewed By: @bertmaher

Differential Revision: D1425862
set PHP_VERSION to 5.6

Summary: Now that @elgenie landed splats and variadics, we are feature complete with 5.6.
Closes #3003

Reviewed By: joelm, smith, eletuchy, liranuna

Differential Revision: D1426390
get us compiling on travis

Summary: They are using an older version of libsqlite3, which our make files don't reject, but we end up not compiling. This is the easiest fix.

Reviewed By: @JoelMarcey

Differential Revision: D1428652
Fix boundary cases of strspn, strcspn and substr_replace

Summary: I'm all for refactoring, but a precondition for refactoring is that the original copies of the code in some way resemble each other. While the bounds checks for strspn, substr_replace and substr might look superficially similar, in fact they can't be merged with a single simple if(strict) to take care of the divergence. The main problem is that multi-pass normalization of the inputs gives you some interesting and arguably broken behaviour when there are multiple issues that need to be simultaneously fixed.

So, unrefactor (expand?) string_substr_check() into its three consistutent parts, with code in the two new parts based closely on the Zend source in the current git master. Remove the "strict" parameter, now implicitly true.

Added a test case which previously failed in multiple ways. In particular, strspn('','x') returned the wrong thing, which broke the MediaWiki parser quite badly. The expect file was generated by PHP 5.5 and is identical to the one generated by PHP 5.3.

Closes #2987

Reviewed By: @ptarjan

Differential Revision: D1393755

Pulled By: @fredemmott
Add MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH logic to store_result

Summary: This is the same as #3016 but moves the implementation to PHP instead.

It actually does not fix the bug itself because PHP behaves the same.
The cause of the segfault is that some people run out of memory resulting in a bad call to calloc.
calloc returns a nullptr which later in mysql is dereferenced.

PHP's solution to this is to call store_result before binding. But this will also fail in hhvm.
This fixes it.

Thanks SiebelsTim for writing the original diff in C++

TL;DR: TEXT in mysql is now variable length instead of 4GB when calling store_result

Fixes #2377
Fixes #2921

Reviewed By: @JoelMarcey

Differential Revision: D1407344
Cleanup in Translator

Summary: I did this while moving inlining into translateRegion().  No change in
functionality; just documentation, reorganization, eliminating dead
functions, etc.

The inlining change requires splitting up translateRegion() a bit, so I
haven't touched translator.cpp.  I also didn't touch translator.h below
the definition of Translator, but I'll probably deal with that later.

Reviewed By: @swtaarrs

Differential Revision: D1427960
bug fix in naming declaration

Summary: During a name collision (on a global symbol, like a class), the name of the
symbol should be bound to the first version of the definition (the one that was
previously there), not the new one (the one that created the collision).
Otherwise it will break the incremental mode.
The incremental logic does the following:
1) remove everything we knew about the declaration
2) redeclare

If after a collision we bind a class name to the new class it will remove
the declaration of the new class (the wrong one) and break.
This bug was likely introduced by the series of diff updating the type-checker
to not stop at the first error.
We use to throw on a naming error and because of that the naming environment was naturally bound
to the first version of the definition.

Reviewed By: @jwatzman

Differential Revision: D1428722
Add basic support for Toran proxy

Summary: Experimenting. We're not using this yet. Removes the dependency on packagist.org. Removes github dependency for stuff installed via packagist, but not for explicit dependencies in the JSON.

Reviewed By: @ptarjan

Differential Revision: D1425023
Add errorlist and sqlstate to mysqli_stmt

Summary: - This adds error_list and sqlstate properties on mysqli_stmt. Mostly copied from the same properties on mysqli

Fixes #3048

Reviewed By: @JoelMarcey

Differential Revision: D1407664
Fix crash on misuse of FormatString (and other newtypes?)

Summary: Once again, we should be adding an error instead of asserting
something.

Reviewed By: @gabelevi

Differential Revision: D1428946
Revert "Adjust the encoding m_pos uses when pointing past the last element"

Summary: Breaks several OSS frameworks

Reviewed By: @ptarjan

Differential Revision: D1429426
Re-record twig

Summary: Broken by PHP_VERSION change.

Reviewed By: @ptarjan

Differential Revision: D1429477
reformat docs, extend .gitignore

Summary: * configure: clean spaces, tab's
* .gitignore: ignore the subfolder "build", build/binary files
* README.md: [related link](https://github.com/denji/hhvm/commit/9fa7fcba90f3e0aacf44929385f91aad762e9ac3?short_path=04c6e90#diff-04c6e90faac2675aa89e2176d2eec7d8)
Closes #3060

Reviewed By: @ptarjan

Differential Revision: D1427535

Pulled By: @fredemmott
Replace non-portable '\e' with '\033' (ESC)

Summary: Warp complains about the use of '\e' as a character literal, which indeed is not allowed (see e.g. http://en.cppreference.com/w/cpp/language/escape). However, I just checked and gcc does accept the sequence. To keep code portable I replaced \e with \033.

Reviewed By: @jdelong

Differential Revision: D1429142
detect proper libdwarf types

Summary: Current master is broken by libdwarf once again. Other than checking for
a particular init function we should also check if we're allowed to use
a const char* for name separately.

Combined them into a macro for future changes.
Closes #3163
Created from: https://github.com/facebook/hhvm/pull/3163

Reviewed By: @ptarjan

Differential Revision: D1429569
Fix a off-by-one error in hack format region mode and make it available in js

Summary: In region mode in the formatter, the formatter was letting the previous token through.

Imagine the following situation:

[0] = \n
[1] = i
[2] = f

I have selected my region to be from position 1 to the end.

With the old logic, when \n is being processed, pos=0 and new_pos=1. Because new_pos is within the region, silent mode is off for \n, even though I have not selected it in my region.

Using new_pos looks intentional, because it's trying to figure out where my current token ends, so this is an off by 1 error.

Reviewed By: @jwatzman

Differential Revision: D1429649
Fix huge stack usage in `Naming.expr_`

Summary: We were apparently just on the edge of what was acceptable
here, and adding frame pointers in the ocaml runtime/compiler pushed us
over the limit. Do something tail recursive.

Reviewed By: @elgenie

Differential Revision: D1429996