Fix crash in hphp
The AnalysisResult for systemlib.php was allowed to go out of scope, taking the FileScope with it, causing us to crash when trying to flatten systemlib traits.
Esse commit está contido em:
@@ -91,6 +91,7 @@ StringToClassScopePtrMap BuiltinSymbols::s_classes;
|
||||
VariableTablePtr BuiltinSymbols::s_variables;
|
||||
ConstantTablePtr BuiltinSymbols::s_constants;
|
||||
StringToTypePtrMap BuiltinSymbols::s_superGlobals;
|
||||
AnalysisResultPtr BuiltinSymbols::s_systemAr;
|
||||
void *BuiltinSymbols::s_handle_main = nullptr;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -329,7 +330,7 @@ bool BuiltinSymbols::Load(AnalysisResultPtr ar, bool extOnly /* = false */) {
|
||||
|
||||
// parse all PHP files under system/classes
|
||||
if (!extOnly) {
|
||||
ar = AnalysisResultPtr(new AnalysisResult());
|
||||
s_systemAr = ar = AnalysisResultPtr(new AnalysisResult());
|
||||
ar->loadBuiltinFunctions();
|
||||
string slib = get_systemlib();
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
static StringToClassScopePtrMap s_classes;
|
||||
static VariableTablePtr s_variables;
|
||||
static ConstantTablePtr s_constants;
|
||||
static AnalysisResultPtr s_systemAr;
|
||||
|
||||
static const char *const GlobalNames[];
|
||||
static int NumGlobalNames();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class X { use IterableTrait; }
|
||||
function test() {
|
||||
$x = new X;
|
||||
var_dump($x->view());
|
||||
}
|
||||
test();
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
object(X)#1 (0) {
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário