Make reading from array with [] an error in most contexts
commita434618f11dee01c7952aac743c581f0457a02db
authorJames Wu <jjwu@fb.com>
Thu, 1 Mar 2018 00:55:46 +0000 (28 16:55 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 1 Mar 2018 01:04:08 +0000 (28 17:04 -0800)
treefc867cc0f9d6857f71dac3afde4a019deaea6133
parentd2b881d00fce74bd88866ca3782df34926f9c54b
Make reading from array with [] an error in most contexts

Summary:
$y = $x[] is banned. This adds a runtime error for its usage.

In my tests, $x[] is allowed only in a few contexts:
- In the context of a reference, i.e. &$x[]
- As an argument to a function
- As an lvalue

Reviewed By: oulgen

Differential Revision: D7058363

fbshipit-source-id: ab959b2d66ddb682874847ffa1ff7abcc33f3431
hphp/hack/src/hhbc/emit_env.ml
hphp/hack/src/hhbc/emit_expression.ml
hphp/test/hhcodegen_failing_tests_zend