Since PresenterComponent::redirect function has optional parameter $code, following code:
if (!is_numeric($code)) { // first parameter is optional
$args = $destination;
$destination = $code;
$code = NULL;
}
if (!is_array($args)) {
$args = array_slice(func_get_args(), is_numeric($code) ? 2 : 1);
}
will cause difference between HHVM interpreter and PHP interpreter. Because func_get_args returns arguments by references instead values in HHVM.
Example in HHVM
calling:
$this->redirect('Question:detail', 50);
will transfer parameters into:
code = NULL
destination = string(15) "Question:detail"
args = array(1) { [0]=> string(15) "Question:detail" }
while call:
$this->redirect('301', 'Question:detail', 50);
results in this:
code = string(3) "301"
destination = string(15) "Question:detail"
args = array(1) { [0]=> int(61) }
Difference between generated urls with route:
new Route('admin/<presenter>/<action>/<id>',...)
is:
admin/question/detail/Question%3Adetail - WRONG
vs:
admin/question/detail/65 - CORRECT!
Since
PresenterComponent::redirectfunction has optional parameter$code, following code:will cause difference between HHVM interpreter and PHP interpreter. Because
func_get_argsreturns arguments by references instead values in HHVM.Example in HHVM
calling:
will transfer parameters into:
while call:
results in this:
Difference between generated urls with route:
is:
vs: