Closed (fixed)
Project:
Semantic CCK
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Jul 2010 at 14:55 UTC
Updated:
18 Jan 2011 at 06:40 UTC
PHP reports the following warning on any page that references Semantic CCK:
warning: Parameter 3 to semantic_cck_field_settings_alter() expected to be a reference, value given in /[path]/includes/common.inc on line 2839.
I am seeing this in my dev system which is running PHP v5.3.1, so this could be new behaviour in 5.3.
I have also tried the 'dev' version of this module, same warning.
Comments
Comment #1
rjay commentedComment #2
owntheweb commentedI'm having the same issue on my new dev server with latest and greatest php version.
Comment #3
gfxguru commentedI'm guessing this is because of the PHP 5.3 issue. Is there any way to fix this without downgrading php?
Comment #4
fm commentedI'm experiencing this same issue.
Comment #5
thekevinday commentedThis is a result of the misuse of the hook_field_settings_alter().
The third parameter cannot be a reference.
To return data to the caller, the first parameter must be used.
Removing the reference means the following code may need to be changed:
Somehow the $field[$setting_name] part must make it into the $additional parameter.
Comment #6
fm commentedI'm still experiencing this issue. It would be smashing if some benevolent developer could fix it.
It sounds as if thekevinday is on the right track diagnosing the problem.
Comment #7
rjay commentedthekevingday is right, however to do this properly would require an API change in CCK itself (to correctly pass $field by reference). In my opinion such an API change would only happen in the next major version of CCK, because it would break any module that is currently implementing hook_field_settings_alter(). I'm not aware of another major version of CCK being planned for Drupal 6, so we're not likely to see any opportunity for a solution through CCK itself.
The alternative is changing the behavior of Semantic CCK, which is likely going to require us to rethink how we are saving the additional field settings that Semantic CCK provides. I was really hoping not to have to create a separate database table for Semantic CCK to store its settings unless we absolutely had to, but I suppose we may have little choice now.
I think rhache and I are going to have to discuss the direction we want to take Semantic CCK from here before we can decide on an appropriate solution to this issue, but I wanted to make sure those affected by this know we're listening and we're working on it. As always, we're open to any suggestions/help from the community.
A temporary workaround (not a fix) is to change Drupal's error reporting settings so that errors/warnings only get sent to the log and not to the screen. These settings can be found under Site Configuration -> Error Reporting.
Update: There is a comment at the beginning of the drupal_alter() function that explains what the underlying problem is. For those interested the explaination can be found here: http://api.drupal.org/api/function/drupal_alter/6 . Strangely, passing variable parameters by reference has actually still worked, with a warning only being raised in PHP >= 5.3 from what I've seen thus far.
rjay
Comment #8
rolfmeijer commentedSame problem here (PHP 5.3.0) but just as important – the settings are not saved. Of course I’m not sure if these issues are related, but if they do I’d say it is critical. I’m going to try to find out if there is a relation (not sure if I’m capable, though… we’ll see).
Edit: test results so far:
Or is it just me that I’m surpised that the module stopped working? In that case, sorry for making a fuss.
Comment #9
thekevinday commentedIs it possible to have this properly solved in drupal-7.x while a workaround is implemented in drupal-6.x?
Comment #10
henrijs.seso commentedSome workaround instructions would be good before postponing.
Comment #11
linuslundahl commentedSubscribe
Comment #12
alisamar commentedSubscribe
Comment #13
CyrilMazur commentedSame issue here, using PHP 5.3, the settings don't save and I simply can't use this module. Too bad.
Comment #14
itangalo commentedsubscribing
Comment #15
itangalo commentedI did a temporary fix on the site where I'm using Semantic CCK – just redefining the function without the pass-by-reference. As thekevinday points out in #5, this unmakes some of the changes that Semantic CCK makes – but at least the warnings go away.
Comment #16
osmansubscribing
Comment #17
rjay commentedI have just committed a fix for this issue to 6.x-1.x-dev.
$fieldis no longer declared as being passed by reference in the implementation of hook_field_settings_alter(), so the warning will no longer occur in PHP >= 3.5.