Hello,
I have installed component module v 1.1.4.2 2010/07/02 and when i try to call back a view with .load, i got this error :
Fatal error: func_get_args():
Can't be used as a function parameter in /sites/all/modules/component/component.module on line 85

So what i did is to replace this :

function component_get_view() {
  return call_user_func_array('views_embed_view', func_get_args());
}

by this : (comes from component.module file from component module v 1.1.4.1 2008/12/02)

function component_get_view($view_name, $display) {
	$args = func_get_args();
	unset($args[0]);
	unset ($args[1]);
	$v = views_get_view($view_name);
	$v->set_display($display);
	$v->set_arguments(array_values($args));
	$v->pre_execute();
	$v->execute();
	return $v->render();
}

and everything worked just fine.

But maybe ther is a better way to solve this issue ?

David

Comments

Crell’s picture

What version of PHP are you running? That could be version-dependent, and to be honest I've not used this module in a very long time, not since views_attach was released. :-)

mr.j’s picture

Status: Active » Reviewed & tested by the community

Same problem (php 5.2). As it states in the PHP docs http://be.php.net/manual/en/function.func-get-args.php

Because this function depends on the current scope to determine parameter details, it cannot be used as a function parameter in versions prior to 5.3.0. If this value must be passed, the results should be assigned to a variable, and that variable should be passed.

The solution is simple - just copy the args into a variable (like it does elsewhere in the module anyway).

--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -82,7 +82,8 @@
 * @see views_embed_view().
 */
 function component_get_view() {
-  return call_user_func_array('views_embed_view', func_get_args());
+	$args = func_get_args();
+  return call_user_func_array('views_embed_view', $args);
 }
 
 /**
Crell’s picture

Status: Reviewed & tested by the community » Needs work

#2 is not a patch. Please submit an actual patch file.

rlnorthcutt’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Closing old issue