when I try to enable this module I am getting an error that states

"Class 'Database'" could not be found in relation_edit.module Line 377

Having searched for this error it is to do with passing variables into a function by reference.

I changed line 377 from

relation_edit_widget_item_submit(&$form_state, $field_name, $delta, &$node_values, &$relation_state, &$item_values, $settings);

to

relation_edit_widget_item_submit($form_state, $field_name, $delta, $node_values, $relation_state, $item_values, $settings);

Cleared the cache via drush and the module loaded.

However I am not sure if the change has made any difference in the module's function relation_edit_widget_item_submit.

Your feedback would be appreciated.

If this is something that can be committed then I think it needs to be as others must be getting this error.

Comments

vadym.kononenko’s picture

StatusFileSize
new688 bytes

I've got the same error: PHP Fatal error: Class 'Database' not found in ... [skip] ... relation_edit/relation_edit.module on line 319

Additional info:

relation_edit.info:
; Information added by drupal.org packaging script on 2011-09-15
version = "7.x-1.0"

318: // Delegate processing of one widget item
319: relation_edit_widget_item_submit(&$form_state, $field_name, $delta, &$subform_values, &$item_values, $settings);

328: /**
329: * Save relations for one widget item.
330: */
331: function relation_edit_widget_item_submit(&$form_state, $field_name, $delta, &$subform_values, &$item_values, $settings) {

http://php.net/manual/en/language.references.pass.php:
Note: There is no reference sign on a function call - only on function definitions.
Function definitions alone are enough to correctly pass the argument by reference.
As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);
And as of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal error.

$ php --version
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with XCache v1.3.2, Copyright (c) 2005-2011, by mOo
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

vadym.kononenko’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new716 bytes

The same patch recreated for the development branch.