Skip to content

Commit

Permalink
Fix is type op usage with pseudoglobals
Browse files Browse the repository at this point in the history
Summary: Fixes #8186

Reviewed By: fredemmott

Differential Revision: D7915366
  • Loading branch information
oulgen authored and fredemmott committed May 10, 2018
1 parent f58f112 commit f639612
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hphp/hack/src/hhbc/emit_expression.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3291,6 +3291,13 @@ and emit_special_function env pos id args uargs default =

| _ ->
begin match args, istype_op lower_fq_name with
| [(_, A.Lvar (_, arg_str as arg_id))], Some i
when SN.Superglobals.is_superglobal arg_str ->
Some (gather [
emit_local ~notice:NoNotice ~need_ref:false env arg_id;
emit_pos pos;
instr (IIsset (IsTypeC i))
], Flavor.Cell)
| [(_, A.Lvar (_, arg_str as arg_id))], Some i
when not (is_local_this env arg_str) ->
Some (instr (IIsset (IsTypeL (get_local env arg_id, i))), Flavor.Cell)
Expand Down
8 changes: 8 additions & 0 deletions hphp/test/slow/typecheck/is_typeop_with_pseudoglobal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

function foo() {
var_dump(is_array($_GET));
var_dump($_GET);
}

foo();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bool(true)
array(0) {
}

0 comments on commit f639612

Please sign in to comment.