Permalink
Switch branches/tags
Nothing to show
Commits on Jun 24, 2011
  1. Fix SSL socket timeout

    scottmac committed Jun 22, 2011
    Summary:
    Haiping you wrote most of this, so hitting you up on the diff.
    
    When reading from a SSL socket there is no timeout hit, if waiting on a fgets
    nothing
    happens.
    
    Needed for when we turn the bots to SSL
    
    Test Plan:
    Test script, noticed it takes 1s to timeout vs 10s and broken pipe.
    
    <?php
    $host = 'tls://irc.corp.facebook.com';
    $port = 6443;
    
    $fp = fsockopen(
      $host,
      $port,
      $errno,
      $errstr,
      10);
    
    if (!$fp) {
      die("no socket");
    }
    socket_set_timeout($fp, 1, 0);
    while ($line = fgets($fp)) {
      echo("->" . trim($line) . "\n");
    }
    fclose($fp);
    echo "End of script\n";
    
    Reviewed By: hzhao
    Reviewers: hzhao, mwilliams, myang, qigao
    CC: ps, mwilliams, mschonbach, hzhao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 271300
  2. Create relative symlinks to logs

    tkho authored and scottmac committed Jun 23, 2011
    Summary: Create relative symlinks to logs when it won't mean creating
    symlinks up the directory tree.
    
    Task ID: #601117
    
    Blame Rev:
    
    Reviewers: kma, myang
    
    CC:
    
    Test Plan: make -j, overwrote local hphpi and restarted webserver. saw
    error.log -> all/error.2011-06-23.log
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 272459
  3. [HPHP Tainting] Default TaintObserver to mutate in ext funcs (generated)

    mxw authored and scottmac committed Jun 21, 2011
    Summary:
    Most of the diff is generated code from running make update-all in
    /src/idl to generate the correct TAINT_OBSERVER calls.  Additional
    changes include:
    - a change to documentation in curl.inc (generated)
    - addition of PHPland tainting constants and removing the defines
      from setup.inc in testing
    
    Reviewing probably boils down to the reviewing following:
    
    In order to preserve the staticness of the format string when it's passed
    through functions like func_get_arg, call_user_func, or array_shift,
    these functions must not enforce a TAINT_BIT_MUTATED by default.  Since
    many of the array and function library extensions don't actually mutate
    their various arguments, I've made a large portion simply propagate taints
    rather than force-setting them.  Meanwhile, no TaintObservers are declared
    in the ArrayUtil library in HPHP (which backends the array extensions),
    which means that untainted keys/values in arrays won't be soiled by tainted
    keys/values.  Functionals still drop into the TaintObservers of their
    argument functions.
    
    I know avoiding looking at any functions was ideally left until it became
    apparent that they needed whitelisting, but since the functions mentioned
    above had to be dealt with, I felt this might noticeably reduce potential
    false positives.
    
    Anyway, the exceptions to the above stated rule are:
    - array_change_key_case: This should taint the keys.  It /shouldn't/
      taint the values.  This is an easy fix but I thought it better not to
      touch lower-level HPHP code in this diff so that it can be processed more
      easily.
    - i18n_loc_*: I don't really know what these do; regardless, unlike
      array manipulations, they probably won't create false positives.
    - call_user_func_serialized: Serializes.
    - create_function: Generates a name.
    
    Notable nonexceptions:
    - array_rand: Key/value pairs are deterministically static or not.
    - compact: Same for variable name/values.
    - array_*diff* and array_*intersect*: The values in the first array
      are always the ones returned in the resulting array.
    - get_called_class: Both this and compact being passive are dependent
      on the assumption that users don't get to make functions and objects.
      This is true, right?  It seems like this should be true.
    
    Note that most functions have been given a passive TaintObserver, even
    the ones not returning strings.
    
    If any of these shouldn't be exceptions, or if any others should, let me
    know.
    
    Test Plan:
    fast_tests, tainting tests
    
    Reviewed By: myang
    Reviewers: srenfro, amenghra, myang
    Commenters: amenghra
    CC: mpal, mwilliams, amenghra, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270330
  4. [HPHP Tainting] Static string support unit tests

    mxw authored and scottmac committed Jun 21, 2011
    Summary:
    - unit tests for static string detection via taints, originally part of
      D268875
    
    Test Plan:
    - these are tests
    
    Reviewed By: amenghra
    Reviewers: srenfro, amenghra, pad
    CC: mwilliams, amenghra
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269450
  5. [HPHP Tainting] Static string detection

    mxw authored and scottmac committed Jun 15, 2011
    Summary:
    - created a new taint bit, TAINT_BIT_MUTATED, for non-static string detection
    - altered base.php to accept the names of constants (e.g., "TAINT_BIT_HTML")
    instead of the values (e.g., 0x1) and defaulted set_mask to TAINT_BIT_MUTATED
    for all functions
    - made a better HPHP warning message for taints
    
    Note that only the string.idl.php functions (and the fb_taint family of
    functions) have been regenerated in the codebase to handle the new taint bit
    properly.  This avoids bloating the diff; the generated code will be pushed
    in a diff after this is reviewed.
    
    Also note that the chosen mechanism marks all strings as not-mutated by
    default and taints them whenever they pass through any library function.
    This is because the layer in HPHP that seems to map to PHP types (various
    source files in runtime/base) doesn't appear to distinguish between PHP string
    literals and other PHP strings; moreover, it seemed that messing around in
    the parser was a Bad Idea (TM).  If either of these things are false, please
    bring it up in review.
    
    NOTE: Moved unit test changes to a separate diff, undid changes to generated
    code except for ext_fb (also all in a separate diff).
    
    Test Plan:
    - fast_tests, slow_tests
    - unit tests in tests/tainting
    
    Reviewed By: myang
    Reviewers: srenfro, qigao, mwilliams, myang
    Commenters: pad, amenghra, qigao, srenfro
    CC: collingreene, ghotz, mwilliams, pad, mwang, amenghra, qigao, srenfro, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268875
  6. [Cleanup] Minor cleanup

    myang authored and scottmac committed Jun 23, 2011
    Summary:
    I replaced a few hard-coded integers with the corresponding enum name. Also
    removed a argument default of function outputCPPPropertyTable that's not used.
    
    Test Plan:
    make fast_tests
    test/test TestCodeRun TestRedeclaredClasses
    
    Reviewed By: qigao
    Reviewers: qigao, mwilliams
    CC: hphp-diffs@lists, ps, mwilliams, qigao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 272326
  7. ICU extension to provide tokenization

    rthibaux authored and scottmac committed Jun 23, 2011
    Summary:
    We've added an extension to do Unicode-safe tokenization/substitution.
    This allows the PHP frontend
    to use the same tokenization functionality that was used to train the
    classifier.
    
    Test Plan:
    Unit tests in test_ext_icu.cpp. Also tested with a PHP script by comparing to
    David's tokenization script.
    
    Reviewed By: davidvickrey
    Reviewers: davidvickrey, myang
    CC: nadeem, ps, mwilliams, davidvickrey
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 272295
  8. [Fix] XHP parser fix

    myang authored and scottmac committed Jun 22, 2011
    Summary:
    The following test program failed to compile:
    <?php
    :test::go();
    
    class :test {
      static function go() {
        echo "Everything's cool\n";
      }
    }
    For :test, it should be parsed as T_XHP_LABEL instead of : and test. We use
    the last token to determine whether to return T_XHP_LABEL or ':'. In the
    beginning there is no last token and the default value of lastToken() is -1.
    Added case -1 to also return T_XHP_LABEL.
    
    Test Plan:
    make fast_tests
    make slow_tests
    
    Reviewed By: qigao
    Reviewers: qigao
    CC: hphp-diffs@lists, ps, mwilliams, qigao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 271590
  9. Namespace support for class constants

    udat authored and scottmac committed Jun 16, 2011
    Summary:
    Parser wasn't accepting namespace static class constants
    
    Test Plan:
    fast_tests
    slow_tests
    then:
    
    <?php
    namespace Test;
    class C {
       protected $arr = array(\NS\C::Constant => 3);
    }
    
    Reviewed By: myang
    Reviewers: myang
    CC: ps, mwilliams, myang
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269346
  10. [Feature] Better stack trace in HPHP

    myang authored and scottmac committed Jun 21, 2011
    Summary:
    HPHP uses a runtime option to control how many frames to include in a PHP stack
    trace. When the stack trace contains more frames than the limit, we only
    display the top limit frames. Normally the limit should not be reached. When
    the limit is reached, often there can be an infinite recursion. I made a
    change so that when there are more frames than the limit, we print out
    half of the limit from the top of the stack and the other half of limit from
    the bottom of the stack.
    
    Test Plan:
    make fast_tests
    
    Reviewed By: qigao
    Reviewers: qigao
    CC: hphp-diffs@lists, ps, mwilliams, qigao, mmachedon, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 271490
  11. html_entity_decode() fails with padded entities

    scottmac committed May 18, 2011
    Summary:
    html_entity_decode() with padded 0's are still decoded in regular PHP since
    it just uses strtol() we appear to skip them if we don't know.
    
    Test Plan:
    make fast_tests
    make slow_tests
    new test case
    
    Reviewed By: stephentu
    Reviewers: mwilliams, myang, hzhao, qigao, stephentu
    CC: amenghra, ps, mwilliams, stephentu
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269910
  12. Overload isset() for int64.

    kma authored and scottmac committed Jun 21, 2011
    Summary:
    We were generating broken code for values that
    were statically determined to be int64's. It looks like
    recent www changes and compiler changes interact to reveal
    this.
    
    Test Plan:
    Introduced new fast test, which failed to compile. It
    works now.
    
    Reviewed By: stephentu
    Reviewers: mwilliams, myang, stephentu
    Commenters: andrewparoski, mwilliams
    CC: ps, mwilliams, stephentu, andrewparoski, kma
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270698
  13. Fix an unserialize crash.

    kma authored and scottmac committed Jun 21, 2011
    Summary: unserialize() interpreted bogus hand-crafted input as a *huge*
    string, and crashed dereferencing null after malloc failed.
    
    Task ID: #607644
    
    Blame Rev:
    
    Reviewers: je, mwilliams, myang
    
    CC:
    
    Test Plan: fast_tests. This test program no longer segvs:
    
      <?
    
      $data = 's:-5:"x";';
      $v = unserialize($data);
      var_dump($v);
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270779
  14. [Perf] Closures with use vars are now implemented as subclasses of a …

    stephentu authored and scottmac committed Jun 17, 2011
    …base
    
    Closure class, instead of using an Array to pass the environment around.
    
    Summary:
    For each closure which declares use vars, a lightweight anonymous closure class
    is generated which declares the use variables as instance members on
    the closure class. This allows us to more efficiently pass the
    variables along, instead of storing them into a PHP array and pulling
    them at upon entry of the closure.
    
    The only exception to this is a closure which is also a generator, in
    which case we fall back to what we used to do. Once we clean up
    generators, then we should also be able to clean this up.
    
    There is also additional cleanup of closures to become more consistent with
    zend.
    First of all, explicitly instantiating a closure will now throw a
    fatal. Second of all, we now get the semantics for duplicate use
    variables right. For example, consider:
    
      $f = function () use ($x, &$x) { $x++; };
    
    versus:
    
      $f = function () use (&$x, $x) { $x++; }
    
    In PHP 5.3, it is the last declaration of the use variable
    which takes effect. So in the first case, $x is by reference,
    and in the second case $x is by value. Third of all,
    subclassing a closure will throw a fatal when you try to
    instantiate an instance of that subclass. The reason we don't
    throw a fatal on seeing the declaration is because hphpc does
    not have a means to properly enforce final classes.
    
    Reviewed By: myang
    Reviewers: myang, qigao, mwilliams
    CC: ps, mwilliams, stephentu, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269343
  15. [Cleanup] Remove two runtime options

    myang authored and scottmac committed Jun 20, 2011
    Summary:
    I removed the runtime options GenHashTableDynClass and SplitDynamicClassTable
    as we have been using the new table-based dynamic_table_class.cpp for some
    time. I will make more changes in dynamic_table_class.cpp and don't want
    to still maintaining the old alternatives.
    
    Test Plan:
    make fast_tests
    make slow_tests
    cd system; make and verified no system file is changed
    
    Reviewed By: qigao
    Reviewers: qigao, mwilliams, stephentu
    CC: hphp-diffs@lists, ps, mwilliams, qigao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270577
  16. Introduce warnings for defining a constant to be an array or object

    oyamauchi authored and scottmac committed Jun 20, 2011
    Summary:
    It's not legal for a constant to have an array or object value in PHP. HPHP was
    allowing this to happen, but it was an oversight.
    
    9 instances of this have cropped up in www, so we can't just kill it off
    immediately. This diff adds warnings if you try to do this, but the defines
    will
    still succeed. Once the instances in www have been cleared out (tasks linked
    from #606317), we can make this match Zend behavior; i.e. make the defines
    fail.
    
    Test Plan:
    make fast_tests, slow_tests
    
    Reviewed By: myang
    Reviewers: myang, qigao, andrewparoski, mwilliams
    CC: hphp-diffs@lists, ps, mwilliams, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270159
  17. [Fix] Still generate compilable code for invalid goto statements

    stephentu authored and scottmac committed Jun 21, 2011
    Summary:
    There are several cases involving goto/labels which cause un-compilable
    code to be generated:
    
    Goto an undefined label:
    
      <?php goto foo;
    
    Declaring an un-used label and/or multiple labels that are the same:
    
      <?php my_lbl: print 'hi';
    
    Writing an explicit goto statement into a try/catch, loop, or
    switch statement:
    
      <?php $i = 3; goto foo; while ($i--) { foo: var_dump($i); }
    
    Yielding from within a try/catch block:
    
      <?php
      function f($x) {
        try {
          yield $x;
        } catch (Exception $e) {}
      }
    
    This commit forces hphpc to still generate valid code in these cases-
    upon executing the invalid goto statement, a fatal is thrown.
    
    Test Plan:
    slow_tests, make sure the
    snippets above still result in compilable code
    
    Reviewed By: myang
    Reviewers: myang, qigao, andrewparoski, mwilliams
    CC: zrait, ps, mwilliams, stephentu, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 270257
  18. [Fix] Access modifiers for static methods are now respected in hphpi

    stephentu authored and scottmac committed Jun 21, 2011
    Summary:
    There was a bug in passing the check parameter in various
    invoke methods in MethodStatement. This commit fixes that, and now
    the following throws a fatal in hphpi:
    
      <?php
      class Foob {
        private static function bar() { return 5; }
      }
      $f = new Foob;
      var_dump($f->bar());
    
    Test Plan:
    fast_tests, try the snippet given in the commit message
    
    Reviewed By: oyamauchi
    Reviewers: myang, qigao, oyamauchi
    CC: ps, mwilliams, oyamauchi, stephentu
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Blame Revision:
    261834
    
    Differential Revision: 270401
  19. [hphpd] don't require prefixing php statements with @/$/= in hphpd

    bhiller authored and scottmac committed Jun 19, 2011
    Summary:
    I was very used to being able to run php statements without prefixing
    them with $/@/= in phpsh, and I thought it would be nice to have that
    functionality in hphpd.
    I wasn't sure who relevant reviewers would be for this diff so I chose people
    who had
    recently committed to this repo, sorry if I chose anyone not interested
    in this.
    
    Test Plan:
    ./src/hphpi/hphpi -m debug -h localhost. tried running these php statements:
    
      > @slog('a');
      > $a = 5;
      > = $a;
      > $a = ent(4);
      > prep($a->prepareFriendIDs());
      > = $a->getFriendIDs();
      > <?php slog(a); ?>
    
    confirmed hphpd commands worked like normal (specifically I tried: ##! ls##).
    
    Reviewed By: myang
    Reviewers: hzhao, myang, andrewparoski
    Commenters: elynde
    CC: ps, mwilliams, myang, elynde
    Revert Plan:
    OK
    
    Differential Revision: 269733
Commits on Jun 20, 2011
  1. Fix getenv() to read variables set from the config

    scottmac committed Jun 20, 2011
    Summary:
    $_ENV, $_SERVER would read hand set variables but getenv() wouldn't
    
    Test Plan:
    hphpi -v "EnvVariables.test=hello" test.php
    
    <?php
    echo $_ENV['test'] . "\n";
    echo $_SERVER['test'] . "\n";
    echo getenv('test') . "\n";
    
    Reviewed By: myang
    Reviewers: mwilliams, myang, stephentu
    CC: ps, mwilliams, myang
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269825
  2. [Perf] Improve performance of call_user_func

    myang authored and scottmac committed Jun 10, 2011
    Summary:
    I added a call_user_func_few_args and did some refactoring so that for
    call_user_func calls with no more than 6 arguments, we can avoid creating
    the argument array for common cases. The generated code looks like
    38c38
    <           const Variant &tmp0((x_call_user_func(2, v_p, Array(ArrayInit(1).setRef(v_i).create()))));
    ---
    >           const Variant &tmp0((call_user_func1(v_p, v_i)));
    
    Task ID: #
    
    Blame Rev:
    
    Reviewers:
    qigao, mwilliams, stephentu
    CC:
    hphp-diffs@lists
    Test Plan:
    make fast_tests
    make slow_tests
    micro benchmark
    <?php
    function foo($a) {
      return $a;
    }
    
    function bar($p) {
      for ($i = 1; $i < 5000000; $i++) {
        $sum += call_user_func($p, $i);
      }
      return $sum;
    }
    var_dump(bar('foo'));
    
    Before:
    time ./program.old
    int(12499997500000)
    
    real    0m1.597s
    user    0m1.559s
    sys     0m0.045s
    
    After:
    time ./program.new
    int(12499997500000)
    
    real    0m0.429s
    user    0m0.400s
    sys     0m0.033s
    
    Compared with calling the function directly on $p:
    <?php
    function foo($a) {
      return $a;
    }
    
    function bar($p) {
      for ($i = 1; $i < 5000000; $i++) {
        $sum += $p($i);
      }
      return $sum;
    }
    var_dump(bar('foo'));
    
    time ./program.direct
    int(12499997500000)
    
    real    0m0.392s
    user    0m0.363s
    sys     0m0.035s
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269067
  3. Fix bug in the C++ backend that was causing the libcore build to fail

    andrewparoski authored and scottmac committed Jun 17, 2011
    Summary:
    HPHP's C++ backend was segfaulting when NO_TCMALLOC=1 and NO_JEMALLOC=1
    were set. It turns out that we were trying to access a string outside the
    bounds of the m_paramNames vector when call time pass-by-reference was
    used at a callsite (ex. "$x = f(&$y);").
    
    This diff fixes type inference to only record call time pass-by-reference
    for formal parameters.
    
    Test Plan:
    make www normally
    
    Reviewed By: stephentu
    Reviewers: myang, stephentu, mwilliams
    Commenters: rogerc
    CC: ps, mwilliams, stephentu, rogerc
    Differential Revision: 269373
  4. Autoload fix

    andrewparoski authored and scottmac committed Jun 18, 2011
    Summary:
    AutoloadHandler::invokeHandler() was incorrectly returning false for
    interfaces. This diff fixes the problem.
    
    Test Plan:
    make fast_tests
    
    Reviewed By: myang
    Reviewers: myang, je
    CC: ps, mwilliams, myang
    Differential Revision: 269448
  5. Fix socket_select() to match PHP behaviour

    scottmac committed Jun 17, 2011
    Summary:
    We switched to use poll() instead of select() to get rid of the maxfd problem.
    
    A negative timeout will provide the same behaviour as NULL to solve the issue
    here.
    
    Test Plan:
    fast_tests
    
    socket_select() test server, checked 0 vs NULL behaviour remains.
    
    Reviewed By: asukhachev
    Reviewers: andrewparoski, asukhachev
    CC: ps, mwilliams, asukhachev
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269257
  6. [Fix] XMLReader would infinitely recurse in its destructor

    stephentu authored and scottmac committed Jun 17, 2011
    Summary:
    Calling into t_close() from the destructor results in infinite
    recursion, since when the dec ref happens, the count will be zero
    and thus triggering the destructor to be called again (and again...)
    
    Test Plan:
    fast_tests
    
    Reviewed By: macvicar
    Reviewers: myang, qigao, macvicar
    Commenters: myang
    CC: ps, mwilliams, macvicar, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 269393
  7. [Fix] Closures and continuations are no longer allowed to be cloned

    stephentu authored and scottmac committed Jun 16, 2011
    Summary:
    Previously, doing something like:
    
      <?php
      $x = function() {};
      $y = clone $x;
    
    or
    
      <?php
      function f() { yield 32; }
      $generator = f();
      $h = clone $generator;
    
    was allowed, and failed to work. This commit makes the clone operation
    fatal, matching PHP 5.3's behavior in the case of closures.
    
    Test Plan:
    slow_tests
    
    Reviewed By: myang
    Reviewers: myang, qigao, andrewparoski
    CC: ps, mwilliams, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268607
Commits on Jun 16, 2011
  1. Namespace fixes

    udat authored and scottmac committed Jun 16, 2011
    Summary:
    Parser was passing in the wrong token, probably due to copy pasting.
    
    Fixes for these came externally.
    
    Test Plan:
    fast_tests
    then run PHP vs HPHP
    
    <?php
        namespace x;
        use \InvalidArgumentException as BaseInvalidArgumentException;
    
        class InvalidArgumentException extends BaseInvalidArgumentException {
    
        }
    
        throw new InvalidArgumentException();
    
    Reviewed By: myang
    Reviewers: myang, mwilliams
    CC: ps, mwilliams, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268565
  2. [Fix] Regen system files for last commit

    stephentu authored and scottmac committed Jun 16, 2011
    Summary:
    Last commit did not regen system files after changing code-gen
    
    Test Plan:
    none
    
    Reviewed By: myang
    Reviewers: macvicar, qigao, myang
    CC: cbueno, ps, mwilliams, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268520
  3. [Feature] Better type hint error message

    myang authored and scottmac committed Jun 15, 2011
    Summary:
    When user forget to turn on runtime option EnableHipHopSyntax, the type hint
    error message can be confusing. For example,
    [] cat /tmp/t.php
    <?php
    function foo(int $p = 1) {}
    [] hphpi/hphpi /tmp/t.php
    HipHop Fatal error: Default value with a class type hint can only be NULL in
    /tmp/t.php on line 2
    
    I made some changes to make the type hint error message more friendly. So after
    the change:
    [] hphpi/hphpi /tmp/t.php
    HipHop Fatal error: HipHop type hint int is not enabled in /tmp/t.php on line 2
    
    Test Plan:
    make fast_tests
    
    Reviewed By: qigao
    Reviewers: qigao, mwilliams
    CC: hphp-diffs@lists, ps, mwilliams, qigao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268072
  4. Fix print_r() for resources

    scottmac committed Jun 16, 2011
    Summary:
    Match PHP behaviour where print_r() on a resource
    prints the id. Currently with HPHP we print an empty array.
    
    Test Plan:
    fast_tests
    slow_tests
    
    Compared PHP and HPHP with
    <?php
    print_r(tmpfile());
    
    Reviewed By: qigao
    Reviewers: myang, mwilliams, andrewparoski, qigao
    CC: ps, mwilliams, qigao
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268217
  5. Fix compile error when class includes method called Dummy

    scottmac committed Jun 15, 2011
    Summary:
    Not sure if we should rename our functions but this work saround the issue.
    
    Prefixing the class name rather than relying on inheritance.
    
    Test Plan:
    fast_tests
    slow_tests
    
    Compiled
    <?php
    
    class Foo {
      public function Dummy() {}
    }
    
    Reviewed By: myang
    Reviewers: mwilliams, myang
    CC: ps, mwilliams, myang
    Revert Plan:
    Ok
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 267381
  6. [Perf] o_realProp for objects now uses static strings in the jump tables

    stephentu authored and scottmac committed Jun 15, 2011
    Summary:
    Dynamic object property lookup now benefits from static
    strings in hash table lookups.
    
    Test Plan:
    slow_tests
    
    Reviewed By: myang
    Reviewers: myang, qigao
    CC: ps, mwilliams, stephentu, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 268076
  7. Added toString() and getStringData() to VRefParam for tainting support

    mxw authored and scottmac committed Jun 15, 2011
    Summary:
    - see title; the switchover from Variants to VRefParams dropped those two
      functions on which tainting depended
    
    Test Plan:
    - compiles; fast_tests, slow_tests
    - nothing calls these methods but tainting and tainting works again
    
    Reviewed By: myang
    Reviewers: mwilliams, myang
    Commenters: amenghra, mwilliams
    CC: srenfro, amenghra, ps, mwilliams, mwang, myang
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 267750
  8. Fix bug in hphp_get_iterator

    andrewparoski authored and scottmac committed Jun 15, 2011
    Summary:
    hphp_get_iterator() was returning null when its parameter was something
    other than an array or an object. This had the unfortunate consequence
    of causing a fatal to be thrown if user code tried to call next() on the
    value returned by hphp_get_iterator(). Example:
    
      for ($__foreach__1 = hphp_get_iterator($foo);
           $__foreach__1->valid();
           $__foreach__1->next()) {
        // ...
      }
    
    This is causing problems for yield generators. A normal "foreach" loop
    in the body of a yield generator gets transformed into something like the
    loop given in the example above, and it will improperly fatal if the value
    being iterated over is not an array or object.
    
    This diff fixes the issue and adds a new test to test_code_run.cpp.
    
    Test Plan:
    make fast_tests
    
    Reviewed By: je
    Reviewers: je, myang, qigao
    CC: ps, mwilliams, je, andrewparoski
    Differential Revision: 267864
  9. [Fix] Remove invalid assertion

    myang authored and scottmac committed Jun 15, 2011
    Summary:
    I removed an invalid assertion that can fail when buildling www.
    
    Test Plan:
    make fast_tests
    
    Reviewed By: qigao
    Reviewers: qigao, stephentu
    CC: hphp-diffs@lists, ps, mwilliams, qigao
    Revert Plan:
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    Differential Revision: 267795