I get this error when trying to enable the module:
PHP Fatal error: Can't use function return value in write context in /path_to_drupal/sites/all/modules/donations_thermometer/donations_thermometer.module on line 119
Line 119 contains this:
if( !empty(variable_get('donations_thermometer_block-' . $block_number . '-description')) ) {
I replaced the following code, including that line:
$block_description = '';
if( !empty(variable_get('donations_thermometer_block-' . $block_number . '-description')) ) {
$block_description = variable_get('donations_thermometer_block-' . $block_number . '-description');
}with this:
$block_description = variable_get('donations_thermometer_block-' . $block_number . '-description','');
I was then able to enable the module and configure a thermometer block. However, I'm not sure my fix has really solved the issue. When I configured the module, I was then required to supply a description for the block before I could save it - I would have expected the code to supply a default description for the block.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | donations_thermometer-php-compatibility-2656388-5.patch | 822 bytes | johnrosswvsu |
Comments
Comment #2
millionleaves commentedUPDATE: changed name to remove reference to PHP 5.4 - that was my initial reading of the error.
Comment #3
nazarioa commentedHello,
I just tried to reproduce this issue on an empty install of Drupal Core (version 7.41) with PHP v5.5.31. I was unable to reproduce it.
Anything else you can give me to help figure this out?
Maybe you had used an older version of donation thermometer previously?
Any info would be awesome.
Nazario
Comment #4
millionleaves commentedAt the time I was installing it for the first time. Someone else ran the site for a while, and I've just come back to it. I've tried to update to 2.1 using Drush, and I'm getting this error:
Looks like the same error - the new version is overwriting the changes I made as outlined above, which is causing it to break again.
Site is running Drupal 7.43, with PHP 5.45.
Comment #5
johnrosswvsu commentedI create a patch to address this issue. Please check.
Comment #6
nazarioa commentedHello John,
Thank you I will apply the patch now. Can you explain to me why this works?
Comment #7
nazarioa commentedI applied the patch provided by the community. Thanks guy, much love.