fix segfault

Don't assume we are in a function.
Esse commit está contido em:
Paul Tarjan
2013-04-25 17:49:50 -07:00
commit de Sara Golemon
commit 5aede8cba8
4 arquivos alterados com 30 adições e 2 exclusões
+3 -1
Ver Arquivo
@@ -400,7 +400,9 @@ void Parser::onCall(Token &out, bool dynamic, Token &name, Token &params,
} else {
const string &s = name.text();
if (s == "func_num_args" || s == "func_get_args" || s == "func_get_arg") {
m_hasCallToGetArgs.back() = true;
if (m_hasCallToGetArgs.size() > 0) {
m_hasCallToGetArgs.back() = true;
}
}
SimpleFunctionCallPtr call
+18
Ver Arquivo
@@ -0,0 +1,18 @@
<?php
var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
var_dump(func_get_arg());
function bar() {
var_dump(func_get_arg(1));
}
function foo() {
bar(func_get_arg(1));
}
foo(1,2);
echo "Done\n";
?>
+9
Ver Arquivo
@@ -0,0 +1,9 @@
HipHop Warning: %a
NULL
HipHop Warning: %a
bool(false)
HipHop Warning: %a
NULL
HipHop Warning: %a
bool(false)
Done
-1
Ver Arquivo
@@ -35,7 +35,6 @@ no_import = (
'/tests/run-test/test010.phpt',
# segfaults
'/Zend/tests/020.phpt',
'/Zend/tests/bug35239.phpt',
'/Zend/tests/bug54265.phpt',
'/Zend/tests/bug55705.phpt',