Hi first I must say nice module just having one small problem here I have this message on all my pages.

• warning: Parameter 2 to ed_classified_link_alter() expected to be a reference, value given in C:\wamp\www\drupal-6.16\includes\common.inc on line 2839.
• warning: Parameter 2 to ed_classified_link_alter() expected to be a reference, value given in C:\wamp\www\drupal-6.16\includes\common.inc on line 2839.

I am running drupal 6.16
Apache 2.2.11
PHP 5.3.0
MySQL 5.1.36

I have included file with a break down of the modules I am using. Any ideas what may be causing this problem.
Thanks for your time and effort.

Comments

bobdalob’s picture

I came across this too. I'm simply transposing the solution to the same problem but with another module, found here.

So you need to edit the ed_classified.module and locate the line "function ed_classified_link_alter(&$node, &$links) {" which appears to be line 226 in the current release. Delete the 2 ampersands ("&"), save and go.

Road Kill’s picture

Hi thanks I will give that a try thank for your time enjoy the day further.

freelock’s picture

Issue tags: +PHP 5.3 compatibility

HI,

This error is due to PHP 5.3 being more strict. However, there's a bigger issue here: it looks like ed_classified_link_alter uses the parameter signature for Drupal 5, and never got updated to Drupal 6.

So here's the fix:

diff --git sites/all/modules/ed_classified/ed_classified.module sites/all/modules/ed_
index 7b81017..7b83765 100644
--- sites/all/modules/ed_classified/ed_classified.module
+++ sites/all/modules/ed_classified/ed_classified.module
@@ -223,7 +223,7 @@ function ed_classified_link($type, $node = NULL, $teaser = FALSE)
  * and the type of links that were just added.  Since we don't we have to 
  * do some checking to find what we are looking for.
  */
-function ed_classified_link_alter($node, $links) {
+function ed_classified_link_alter(&$links, $node) {
   module_load_include('inc', 'ed_classified', 'ed_classified_utils');
 
   // array with keys like [taxonomy_term_n] => title, href, etc.

... in other words, put the &$links before $node on line 226, and remove the ampersand in front of $node.

Cheers,
John

freelock’s picture

Category: support » bug
Status: Active » Needs review

This should get fixed, BTW...

zyxware’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new528 bytes

I have converted the fix by freelock into a patch. The change works fine for me on PHP 5.3.

verta’s picture

I manually made the change from
function ed_classified_link_alter(&$node, &$links) {

to
function ed_classified_link_alter($links, $node) {

(I am using
// $Id: ed_classified.module,v 1.1.4.45.2.35 2009/08/13 02:12:27 milesgillham Exp $
which is the current alpha.)

and confirm that it cures this error message. If there is another alpha or a beta maybe this can make it in there?

fgm’s picture

Status: Reviewed & tested by the community » Needs work

This patch fixes 6.2 for Drupal 6, but breaks it for Drupal 5, and the hallmark of the 6.2 branch is/was compatibility with both 5.x and 6.x.

Branch 6.3 does not have this issue, as it does not implement hook_link_alter() anyway.

freelock’s picture

Status: Needs work » Reviewed & tested by the community

@fgm see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo... .

The API for hook_link_alter changed between Drupal 5 and Drupal 6. This patch is appropriate, and matches the new API for D6, which makes it necessary! (Actually there is now a 3rd optional parameter passed, $comment = null).

The links won't function in the 6.x branch properly unless the code is updated for the Drupal 6 api.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 879200-ed_classifieds-hook_link_alter_param_fix.patch, failed testing.

fgm’s picture

@freelock: yes that's what I wrote: this patch fixes the 6.2 branch, but breaks 5.x compatibility and 5.2/6.2/7.2 strove to be one code for all three versions. But since 5.x is no longer supported and 7.2 is likely to be replaced by 7.3 too, this /could/ no longer be a problem.

However, going all the way in that direction would mean removing all the code dedicated to 5.x in the 6.2 branch since it no longer serves any purpose, and that's a big change, and actually the origin of the 6.3 branch. See #777734: De-merge versions for more about this.

I think this is just too big a change for a small issue like this, and a patch for this issue should do just as the 6.2 code does elsewhere: define the function signature depending on the current Drupal version, to remain 5.x-compatible. This is how hook_menu() is implemented in 6.x-2.x-dev, for instance:

switch (reset(explode('.', DRUPAL_VERSION))) {
  case 5:
    function ed_classified_menu($may_cache) {
 //...
  case 6:
  case 7:
    function ed_classified_menu() {
 //...
fgm’s picture

Status: Needs work » Needs review
StatusFileSize
new1.68 KB

Patch fixes issue as suggested, and a few others as well.

fgm’s picture

Status: Needs review » Fixed

Fixed included in 6.x-2,x commit 75f15a044 on 2011-07-31, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.