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
Revert "detect proper libdwarf types"

Summary: refs facebook/hhvm#3163

Breaks centos build: https://gist.github.com/fredemmott/ffa79f0c9cadd30b87ba

Reviewed By: @ptarjan

Differential Revision: D1430034
typechecker: interaction of interface req + trait req + inheritance

Summary: ... very subtle bug with the visibility of protected methods
 inside traits when the relevant requirements go through an interface.

Reviewed By: @jwatzman

Differential Revision: D1428536
Do not produce refcount in LdResumableArObj, use TakeRef instead

Summary: LdResumableArObj just loads pointer to an object, but does not produce
reference count, so remove the PRc tag. Instead, add TakeRef opcode to
produce the reference count to make refcount optimizer aware of implicitly
owned references.

Reviewed By: @swtaarrs

Differential Revision: D1429349
delete extra space on main.cpp

Summary: Closes #3164
Created from: https://github.com/facebook/hhvm/pull/3164

Reviewed By: sgolemon, liranuna

Differential Revision: D1429520