Hi,
for another module I plan to add an additional array key in hook_libraries_info().
#1781794: Registration of additional PSR-0 folders in modules and sites/all/libraries

I would find it very attractive if I could put closures (anonymous functions) in there.
Unfortunately, I found that php cannot serialize closures.

So, the question: Do you ever plan to serialize the result from libraries_get_info(), e.g. to cache it between requests? Because then the closure is out..

Thanks!

Comments

donquixote’s picture

This is a non-issue.
If you ever do serialize this stuff, I will simply implement hook_libraries_info_alter(), and turn the closures into arrays.
The exact format of those arrays can be determined another day.

donquixote’s picture

Status:Active» Fixed

Sorry, wanted to close as fixed.

Status:Fixed» Closed (fixed)

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

donquixote’s picture

Issue summary:View changes

This has happened now. Libraries info is serialized in libraries_load().
This showed up in #2279981: Serialization exception if namespace is registered with libraries, and is being fixed with an old trick to remove all closures with hook_libraries_info_alter(), and restore the by calling the respective libraries hook implementation again.

I wish I had implemented the libraries integration differently, requiring libraries_load() to be called before the namespaces are registered. Now I have to do extra babysitting for BC support :(

There is nothing to do in Libraries API, but I still want to document this.