Skip to content

Commit

Permalink
add killswitch for raise_notice on Reflection::getConstants
Browse files Browse the repository at this point in the history
Summary: Add a killswitch for raising notice whenever  `ReflectionClass::getConstants` is used on enums or enum classes that use/extend other enums.

Reviewed By: viratyosin

Differential Revision: D65240052

fbshipit-source-id: 5109742c83f19c2cdd8d3237e90cb41d42fca45a
  • Loading branch information
Francesco Zappa Nardelli authored and facebook-github-bot committed Oct 31, 2024
1 parent 7df3692 commit 363a891
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hphp/doc/configs.specification
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ The format can be found in hphp/tools/configs/generate-configs.rs

Synchronize class loading between threads

- bool Eval.ReflectionMissConstantFromIncludedEnumsNotice = false, fzn

Whether ReflectionClass::getConstants raises notice if it misses constants from
enums/enum classes included via enum inclusion

# Hack.Lang

- bool Hack.Lang.DisableLvalAsAnExpression = false, UNKNOWN, repooptionsflag(Parser)|hackc(parser)
Expand Down
3 changes: 2 additions & 1 deletion hphp/runtime/ext/reflection/ext_reflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@ void addClassConstantNames(const Class* cls,
}
}
}
if (has_constants_from_included_enums) {
if (has_constants_from_included_enums &&
Cfg::Eval::ReflectionMissConstantFromIncludedEnumsNotice) {
raise_notice(Strings::REFLECTION_MISS_CONSTANTS_FROM_INCLUDED_ENUMS,
cls->name()->data());
}
Expand Down
1 change: 1 addition & 0 deletions hphp/test/slow/enum_supertyping/reflection.php.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-vEval.ReflectionMissConstantFromIncludedEnumsNotice=true

0 comments on commit 363a891

Please sign in to comment.