When the activitystream_flickr module is enabled on a site using other modules which take advantage of PEAR, retrieval fails if another module has already required the PEAR HTTP_Request class.
The error message is,
Fatal error: Cannot redeclare _pear_call_destructors() (previously declared in /home/www-home/apps/civicrm-3.1.2/civicrm/packages/PEAR.php:773) in /home/www-home/drupal6/sites/all/modules/activitystream/activitystream_flickr/PEAR/PEAR.php on line 783
(An example module which can trigger this conflict is CiviCRM.)
Solution is to check whether class_exists('HTTP_Request') before requiring the file. Because phpFlickr uses the directory path in its call to require_once, the previous require_once of another version of same does not get picked up.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 733280-activitystream-simple_path.patch | 4.99 KB | xurizaemon |
| #1 | 733280-activitystream-1.x-dev.patch | 5.08 KB | xurizaemon |
Comments
Comment #1
xurizaemonLooks like this patch applies to both 1.x and 2.x series. Check if class_exists() before require.
Comment #2
xurizaemonUpdating title
Comment #3
xurizaemonrequire_once()implements theifstatement itself; the bug here is that the path to the required file has been artificially made unique, which makes the use ofrequire_once()effectively a call torequire()...Here's a better patch, which seems to play nicely with other systems using PEAR libs in the recommended manner.
PEAR standards* (which we should follow when in PEAR-specific code) add PEAR to the include_path and then reference the file from the top of the PEAR tree. Example fixed issue.
A similar fix appears to have been already applied to the phpFlickr code between v2.3.0.1 (currently included as part of ActivityStream_Flickr) and v2.3.1.1 (current release).
The patch below will only fix the issue reported here; I haven't tested upgrading to the latest phpFlickr release - that's probably worthy of a separate issue** (which would also resolve this one).
* as I understand them - can't find a reference right now - prove me wrong!
** #735406: Update phpFlickr include to current version
Comment #4
akalsey commentedLatest phpLFickr doesn't use PEAR. Updated in dev.
Comment #5
akalsey commentedIn beta2