-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hack] adding a test file about variadic arguments
Summary: Now that Textual is able to translate variadic arguments to SIL, we need to tell Pulse how to analyse them. We set the playground with this test. Reviewed By: vsiles Differential Revision: D50120795 Privacy Context Container: L1208441 fbshipit-source-id: d47704c3e4ee66666afabf44030ae970164ee816
- Loading branch information
1 parent
067f646
commit 16c3802
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
namespace DictTests; | ||
|
||
class Variadic { | ||
|
||
public static function variadicArgInSink(int $i, int ...$args) : void { | ||
foreach ($args as $arg) { | ||
\Level1\taintSink($arg); | ||
} | ||
} | ||
|
||
public static function variadicArg0InSink(int $i, int ...$args) : void { | ||
\Level1\taintSink($args[0]); | ||
} | ||
|
||
public static function callVariadic(int ...$args) : void { | ||
self::variadicArgInSink(0, ...$args); | ||
} | ||
|
||
public static function FN_callVariadicWith2ArgsBad(int $i) : void { | ||
self::variadicArgInSink(0, \Level1\taintSource()); | ||
} | ||
|
||
public static function callVariadicWith2ArgsOk(int $i) : void { | ||
self::variadicArgInSink(\Level1\taintSource(), 0); | ||
} | ||
|
||
public static function FN_callVariadicWith3ArgsBad() : void { | ||
self::variadicArgInSink(0, 0, \Level1\taintSource()); | ||
} | ||
|
||
public static function FN_callVariadicWith3ArgsBisBad() : void { | ||
self::variadicArgInSink(0, \Level1\taintSource(), 0); | ||
} | ||
|
||
public static function FN_transitiveCallVariadicWith2ArgsBad(int $i) : void { | ||
self::callVariadic(\Level1\taintSource()); | ||
} | ||
|
||
public static function FN_transitiveCallVariadicWith3ArgsBad() : void { | ||
self::callVariadic(0, \Level1\taintSource()); | ||
} | ||
|
||
public static function FN_transitiveCallVariadicWith3ArgsBisBad() : void { | ||
self::callVariadic(\Level1\taintSource(), 0); | ||
} | ||
|
||
public static function FN_callVariadicArg0InSinkBad() : void { | ||
self::variadicArg0InSink(0, \Level1\taintSource()); | ||
} | ||
|
||
public static function callVariadicArg0InSinkOk() : void { | ||
self::variadicArg0InSink(0, 0, \Level1\taintSource()); | ||
} | ||
|
||
public static function callVariadicArg0InSinkBisOk() : void { | ||
self::variadicArg0InSink(\Level1\taintSource()); | ||
} | ||
} |