PHP deprecated call time pass by reference, but the module does this:

function libraries_detect($libraries) {
  foreach ($libraries as $name => $library) {
    libraries_detect_library(&$libraries[$name]);
  }
  return $libraries;
}

function libraries_detect_library(&$library) {
 // ...
}

Basically it tries to avoid foreach copying the value and instead would like to get the original value to work with. We can do that much easier with PHP 5's foreach reference syntax, just need to move the &, so it becomes:

function libraries_detect($libraries) {
  foreach ($libraries as &$library) {
    libraries_detect_library($library);
  }
  return $libraries;
}

function libraries_detect_library(&$library) {
 // ...
}

The attached patch does this. Foreach is capable to do this in PHP 5 and Drupal 7 already requires PHP 5, so I did not bother putting the PHP requirement into the .info file.

CommentFileSizeAuthor
avoid-call-time-pass-by-ref.patch663 bytesgábor hojtsy

Comments

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good.

gábor hojtsy’s picture

Great :) Looking forward to the commit.

sun’s picture

Sorry, forgot to grant you access in #1. Could you just go ahead and commit? :)

sun’s picture

But also please note that #719896: Add a hook_libraries_info() still holds a follow-up patch, which will probably change key aspects of these new functions. Contributions, reviews, feedback, commits welcome.

tstoeckler’s picture

Status: Reviewed & tested by the community » Fixed

Committed the above patch. See http://drupal.org/cvs?commit=395090. (I feel very powerful right now :))
Thanks for the patch!

Status: Fixed » Closed (fixed)

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