Replace NEWOBJ macro with newobj<T> and newres<T> functions.

Summary: We already had to do different things for objects and resources,
and heap parsability will make them diverge further. This diff
makes them a) modern and b) easier to grep for.

ext_zip also had some bugs that this fixes.

Reviewed By: @jdelong

Differential Revision: D1655816
Enforce void return on native class constructors/destructors.

Summary: Also allow omitting return type for these methods
(implicit void).

Closes #4044

Reviewed By: @paulbiss

Differential Revision: D1657375

Signature: t1:1657375:1415082475:bca86e2593d6003d94be5ed5f3dbd442200d986d
Canonicalize path in CURLOPT_POSTFILEDS '@file/name' usage

Summary: The CURLOPT_POSTFIELDS option takes an
overloaded value which may be of the form:

"@/path/to/file;type=text/plain;filename=foo"

The existing implementation assumed all filenames were
absolute paths, and was thus breaking on relative uris.

Add a call to File::TranslatePath() to canonicalize these.

Also addressed a possible race-condition when modifying
a constant c_str() which may belong to a shared static string.

(Hopefully)
Closes #4098

Reviewed By: @JoelMarcey

Differential Revision: D1656226

Signature: t1:1656226:1415077931:4f2d849b4ef669414dd7943de37601db4ed05c85
Make sort()/ksort() mirror php5 in EnableZendSorting mode

Summary: Fixes #3545

Reviewed By: @ptarjan

Differential Revision: D1512943
Fix File::readCSV for crlf line termination

Summary: When we see a "\r" at the end of the buffer when reading a line in File we should read ahead further to see if it's part of a "\r\n".

Fixes #1658

Reviewed By: @sgolemon

Differential Revision: D1656908

Signature: t1:1656908:1415080300:9e9e054f4986057d311f716f89a6bffa3ed8eef6
Allow duplicate items in encoded urls

Summary: Fixes #3878

Reviewed By: @sgolemon

Differential Revision: D1633028

Signature: t1:1633028:1414515060:c5eec7b2d50f67a81098a929b8c191d40eb87f96
Use int64_t when scanning integers, not int.

Summary: sizeof(int) == 4 means that we'll have overflow on large integers

Closes #3449

Reviewed By: @paulbiss

Differential Revision: D1657453

Signature: t1:1657453:1415121399:a71cf3326274f29caf3b825e7413bea332661cfd
Fixed xpath's php:functionString

Summary: Added CallerFrame before dom_xpath_ext_function_php's call to xmlXPathEvalExpression in case libxml2 needs to call back into HHVM.
The xpath query might contain ```php:functionString``` which triggers a call to any arbitrary php function.

Also fixed a bug where the arguments in an xpath php:functionString were reversed. For example, if the xpath was ```/foo[php:functionString('preg_match', '{$regex}',@​bar)]```, preg_match was being called as ```preg_match($bar, $regex)``` instead of ```preg_match($regex, $bar)```.

Closes https://github.com/facebook/hhvm/pull/4120

Reviewed By: @sgolemon

Differential Revision: D1656106

Signature: t1:1656106:1415132682:3423279074575c41ba3f39136ab2abd3f29ae232
Invert how hh_server gets hhi embeds

Summary: Change some FB-internal build scripts, and add a comment.

Reviewed By: @int3

Differential Revision: D1658042

Signature: t1:1658042:1415126267:110682c52c6711465a9634c6a121adb3d38c285f
Use timelib_diff to calculate datetime intervals

Summary: Fixes #2952

Reviewed By: @JoelMarcey

Differential Revision: D1657306

Signature: t1:1657306:1415077618:3781defe888af49033d1743a7d50aa48612141a0
Convert a few ARM opcodes to DELEGATE

Summary: This is just a few of the easiest ones, to get started with. It helped
to flush out a few issues:

- x64's implementation of DefSP was referring to rbp explicitly, instead
  of the tmp representing the frame pointer.

- ARM was defining a status flag register twice; this looks like a rough
  edge of the conversion to explicit status flags.

Reviewed By: @edwinsmith

Differential Revision: D1658070
Deep initialization for constant properties

Summary: Defined constants may be ref-counted (e.g. resources) and require deep
initialization when used to initialize instance properties.

Fixes #4111

Reviewed By: @fredemmott

Differential Revision: D1658088

Signature: t1:1658088:1415137574:011205e3e604bb711437149f2ef1ed3b3be830b5
Initial sort should be density based

Summary: The initial order of functions influences the final
clustering - so we should use samples/byte, not samples to
sort them.

Reviewed By: @ottoni

Differential Revision: D1657737

Signature: t1:1657737:1415119241:e145694681f86a14ae63a23f73a2011e1dfd6347
Add HH\int/float/bool typehints to PHP

Summary: - Support HH\(string|int|float|bool) in PHP without hhvm.force_hh
- (string|int|float|bool) in PHP without in hhvm.force_hh still refer to classes

These are not intended for direct usage by developers.

Mocking frameworks find the parameter typehints using reflection, then generate
mocks in PHP using the same typehint. 3 ways to fix this came to mind:

 - Always support HH\foo scalar typehints
 - Modify Reflection to not return these
 - Modify these mocking frameworks to filter out scalar typehints

This diff takes the first option.

fixes facebook/hhvm#4021

Reviewed By: @paroski

Differential Revision: D1642075

Signature: t1:1642075:1414634502:1901bd88b334adfa9b0b39925d706675892f6411
Allow systemlib function declarations to use reserved words for function names

Summary: This allows builtin classes to define methods like "include" or "declare".
Necessary for replicating PHP5 extension interfaces in HNI.

  class Foo {
    public function include(string $file): bool {
      include($file);
      return true;
    }
  }

  (new Foo)->include("/bar/baz.php");

Closes #2022

Reviewed By: @paulbiss

Differential Revision: D1658153

Signature: t1:1658153:1415127992:e16e66ff2b5f6bef37e56be7e58d9a0fe86af4d3
Remove uspoof SINGLE_SCRIPT test.

Summary: It's deprecated on ICU >= 51

Closes #3925

Reviewed By: @JoelMarcey

Differential Revision: D1658533

Signature: t1:1658533:1415134838:c7bd38f7fdfed37acbcee497da7e7aed94d16850
Explicitly set -Wno-unused-function in gcc flags

Summary: This should be the default, but for systems
where it isn't, explicitly say so.

Closes #2515

Reviewed By: @JoelMarcey

Differential Revision: D1658664

Signature: t1:1658664:1415134757:d4d26bec54469d0bee379d4134c4d3c3e98b3dd1
Suppress compilation error by undefining basename macro

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

Reviewed By: @sgolemon

Differential Revision: D1658567

Signature: t1:1658567:1415147482:2d83b43e9b00743f939bf36f4377114bdd2568a7
Update .noserver files for in-memory sqlite dbs

Summary: The ':memory:' sqlite3 file can cause conflicts when multiple tests
run in the same server process.

Reviewed By: @jdelong

Differential Revision: D1659326

Signature: t1:1659326:1415144962:8b10e2c405b8cb3cd047d2249d561e68c2079314