I'm not sure if I'm missing something but it seems like the code for libraries_get_version isn't actually checking the entire file. This statement:
if (preg_match($options['pattern'], $line, $version)) {
is always going to return TRUE. If the last argument was omitted, then it would return a proper boolean.

It seems like the code isn't ever getting past the first line.

CommentFileSizeAuthor
#1 libraries-get-version-2238369.patch707 bytesasherry
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

asherry’s picture

Status: Active » Needs review
FileSize
707 bytes

This patch changes the 3rd argument to $result, and checks for $result[1] every time. If that is not empty then we have a version, so we populate the $version variable.

We also don't want to return immediately because then fclose is never called.

This patch fixed that for me too.

asherry’s picture

Assigned: asherry » Unassigned

Removing ownership, I just want to clarify this should be reviewed by a maintainer.

Chris Matthews’s picture

The 5 year old patch to libraries.module applied cleanly to the latest libraries 7.x-2.x-dev and if still applicable needs review.