If a module specifies an array as the value for the version callback of a library, and doesn't have any version arguments, libraries will have a fatal error. If the module does specify version arguments, passing an array as the version callback works, because in that case call_user_func_array is used. This can be remedied by using call_user_func when there aren't any version arguments, making libraries's behavior consistent.

This came up when working with the 3.x dev version of Openlayers: array('\Drupal\openlayers\Openlayers', 'getLibraryVersion') is passed as the version callback, but there aren't any version arguments, so PHP complains that the function name should be a string. Using call_user_func instead fixes this, because both this and the array version accept arrays as the first parameter.

Comments

robinsonsarah01 created an issue. See original summary.

tstoeckler’s picture

Status: Needs review » Fixed

Thanks very much! Makes a lot of sense. Committed to 7.x-2.x

Status: Fixed » Closed (fixed)

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