Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
node.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Sep 2009 at 07:17 UTC
Updated:
13 May 2013 at 12:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drasgardian commentedFor the time being I have simply changed comment.module and removed "&" from this line:
Looking forward to a cleaner solution that doesn't involve me editing core.
This bug doesn't seem to be related to any other modules or themes that are installed. I'm running drupal 6.14 and php 5.3 on centos 5.3.
Comment #2
infojunkiesubscribe, same config
Comment #3
mot commentedWe have a standard XAMPP installation here which ships with php 5.3 as well. I get the error message(s) only when a search term is found. You get one error message per node found. E.g. if your term is found in 4 nodes, you get 4 times the error.
Comment #4
pimentoski commentedi have the same problem. php 5.3 + drupal 6.14 in xampp the fix posted by drasgardian works for me.
Comment #5
obelus commentedHi, I have the same problem, like drasgardian had described. The same warning wrote me drupal after searching. If searching something find it write the results and same count of mentioned warnings (warning: Parameter 1 to comment_nodeapi() expected to be a reference, value given in [drupal path]/drupal-6.14/includes/module.inc on line 450.) like the count of results. If searching is without results, no warning is written.
For this time, I make the same like drasgardian did. Its ok now, but like he wrote, it is not "clear" if we have to edit core.
Thank you for new tips and advices.
Comment #6
nicksanta commentedWhat action are you guys performing to get this error? I'm using php 5.3.0, and i can't replicate this problem by creating, editing or deleting a comment. I've also tried creating, editing and deleting nodes, modifying the comment settings etc.. and cant get it to happen.
Comment #7
silviucostiniuc commentedYep the same problem to me. When running a search, if it finds any result, it shows the result but also the warning:
Parameter 1 to comment_nodeapi() expected to be a reference, value given in .
I'm also using the last version of XAMPP (that comes ) with PHP 5.3.
I think this is not the single problem ON PHP 5.3 concerning the "references". For the Views module there is also a "reference problem".
You can view the topic here:
http://drupal.org/node/452384 (Make Views compatible with PHP 5.3)
Comment #8
liam mcdermott commented@nickurbits: it's searching that causes the problem, specifically the search results page when using core's search.module. It seems the error is generated once per search result.
Comment #9
pirna commentedAfter update to drupal 6.15 I get the same error (after a search).
warning: Parameter 1 to comment_nodeapi() expected to be a reference, value given in D:\xampp\htdocs\drupal\includes\module.inc on line 462.
Comment #10
yhager commentedsubscribing.
The "fix" in #1 is not good, since comment_nodeapi expects the value to be a reference, but the caller, which uses call_user_func_array can only send values.
I think it is ok to change this to critical since it means that comment_nodeapi() does not function well on PHP 5.3 environments.
Comment #11
berdirThe function definition needs to be as it is to keep compatibility with PHP 4.
Something (I suspect a contrib or even custom module) is calling the hook in a wrong way. I've explained how to figure out *who* that is at #360605-198: PHP 5.3 Compatibility. You just need to place those 3 php lines at the top of the comment_nodeapi() function. When the error happens, it should display how that function was called and by whom. Feel free to post the whole output here and I'll help to determine which module is doing something wrong ;)
Comment #12
yhager commentedThe tip in #360605-198: PHP 5.3 Compatibility did not help by itself, since there is no indication inside comment_nodeapi that there is a problem. I implemented something along these lines in drupal_error_handler, adding the following:
The output I received after performing a search was:
The problem is with using call_user_func_array to pass values by reference, see comment #10 above.
Comment #13
berdirJust for the reference, it is possible to use call by reference with call_user_func_array, you have to the single $param entries by reference. See http://drupal.org/drupal_execute for an example.
However, the code that does trigger only calls comment and taxonomy with module_invoke (which I find more than ugly., but that's not the topic of this issue :)). The attached patch changes these calls to normal function calls. Should work with that.
Comment #14
berdirHm. something wrent wrong :)
Comment #15
yhager commentedFixed a typo in the previous patch. works for me.
Comment #16
tovstiadi commentedsubscribe
Comment #18
ti2m commentedgreat, thanks a lot, seems to fix the issue for me
Comment #19
thtas commentedsubscribing
Comment #20
yhager commentedCan anybody explain why the bot fails the patch? I went to the error log, and ran the same 'patch' command as the bot did, and it worked. So what needs to be done here exactly?
$ wget http://drupal.org/files/issues/node_search_php53_fix_1.patch -O /tmp/node_search_php53_fix_1.patch
$ patch -p0 -i /tmp/node_search_php53_fix_1.patch
patching file modules/node/node.module
Hunk #1 succeeded at 1282 (offset 2 lines).
Comment #21
gcclinux commentedsame error version:
drupal 6.14 and php 5.3.1 running mandriva 2010
Comment #22
yhager commented@gcclinux - can you try the patch above?
Comment #23
gcclinux commentedall fixed.... thanks
Comment #24
janspeer commentedsame error,
but I access my site via the webbrowser or ftp, how can I repair this,
I dont think I can run a patch
can i do the change manual ? pls explain how.
thanks
Comment #25
attishu commentedsubscribing
Comment #26
Anonymous (not verified) commentedpatch worked fine for me 6.15 drupal core
Comment #27
dooug commentedsubscribe
Comment #28
Catx commentedI see same problem in my site. In addition more like user_reference . . Error error. Where the owner of drupal? Why not make module.inc complete error free for php 5.2. Why patch? I dont know here many people. No one here to make perfect module.inc Only 1 file headche in site. Please team make it before drupal7. I wait for complete file.
Comment #29
Catx commentedI see same problem in my site. In addition more like user_reference . . Error error. Where the owner of drupal? Why not make module.inc complete error free for php 5.2. Why patch? I dont know here many people. No one here to make perfect module.inc Only 1 file headche in site. Please team make it before drupal7. I wait for complete file.
Comment #30
Catx commentedI try all thing. In 2 patch only difference
1. if (module_exists('taxonomy')) (
2. if (module_enabled('taxonomy')) (
In both case no work.
Comment #31
Catx commentedI put those three line in my site http://surf3d.com Check what happen. Site open from desktop but disappear from mobile surf. Tell me what i do next.
Comment #32
mikejonesok commentedUpdate for Drupal 6.16?
Comment #33
berdirPatch applies fine on 6.x-dev for me and should do so on 6.16...
Comment #34
berdir#15: node_search_php53_fix.patch queued for re-testing.
Comment #35
yasser1820 commentedi have the same problem when i make a search in my site : warning: Parameter 1 to comment_nodeapi() expected to be a reference
what can i do ??? pls need help .
i have php 5.3 .. apache server ... ( i am working on Xampp)
i downloaded Drupal 6.16 ..and every thing is up to date ....
Comment #36
yasser1820 commentedi found a solution that worked for me ..... i was enabling the Comment module .... in the modules >> core options >> Comments .... while i have no place for the users to enter comments .... i disabled it and every thing worked ... i don't receive this message any more .
i hope this can help some one ...
Comment #37
Brian Keller-Heikkila commentedThe patch in #20 used to work for me in 6.15, but does not work in 6.16. Since 6.16 changed node.module, I manually applied the 2 if statements (mentioned in #30) to lines 1288 and 1290, but it does not work. 6.16 still shows the error about comment_nodeapi.
The only way I can get rid of the error messages is to comment out lines 1288 and 1290 of node.module. This is definitely not ideal since it removes functionality from the search, but with a live site, we cannot have error messages showing.
Anyone know how to fix properly for 6.16?
Comment #38
francisconi.org commentedI solved simply by replacing in /modules/comment/comment.module
function comment_nodeapi(&$node, $op, $arg = 0) {
by:
function comment_nodeapi($node, $op, $arg = 0) {
which is what Mr. drasgardian proposed that the application of the patch did not work and node_search_php53_fix.patch spoiling me
Comment #39
berdirThat change would break PHP4 compatibility and is therefore not possible.
I'll try to patch to see if there are any additional errors soon.
Comment #40
DaveX commentedIs there a solution?
I have the same problem. I use PHP 5.3.1 an Drupal 6.16
Comment #41
ayalsule commentedsubscribe
6.16 + 5.3.1
there is a lot of problems with 5.3
Comment #42
ayalsule commentedwhat about 6.16?
no solution?
Comment #43
DaveX commentedIs a patch available? (PHP 5.3.1, Drupal 6.16)
On my site the search function is essential. With the errors it is not usable, it is confusing. :-(
Comment #44
fblevins commentedI got the same thing. I'm new to Drupal and have the most recent stable versions of Drupal and PHP running. Thought I'd messed something up somewhere down the line but now see that this is a real issue. Not a problem right now because I'm just learning, but it would be nice if this got fixed somewhere down the line (wish I could just fix it for everyone, but I'm such a NOOB)!!!
Comment #45
francisconi.org commentedI agree with what he says Mr. Berdan
But if you use PHP 5.3 (and do not plan to reuse PHP 4), the solution (at least it is temporary)
I solved simply by replacing in /modules/comment/comment.module
function comment_nodeapi(&$node, $op, $arg = 0) {by:
function comment_nodeapi($node, $op, $arg = 0) {Comment #46
janspeer commentedI have set in admin the selection "log to file" and not "log to file and screen" and then you don't see the warnings anymore
Comment #47
berdirThe patch from yhager in #15 still works fine in 6.16, so just use that one. I can't RTBC it since I pretty much wrote the patch, but maybe someone else can.. ;)
Comment #48
virtualmcube commentedpatch worked fine for me, i am running my site with drupal 6.15...
Comment #49
b3liev3 commentedThe patch works. It's the same with all the php 5.3 issues.
Comment #50
jimrockford commentedMe: PHP 5.3.1 and Drupal 6.16
node_search_php53_fix.patch from #15 had no effect in resolving error message
#1 & #38 suggestion did fix the issue.
Looking at function body for comment_nodeapi(), the only part where the node appears to be modified, and therefore ref vs obj _is_ important, is in the "prepare" case. It contains:
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
What's the importance of that line?
All other references to $node in the function appear to only be reads, so it wouldn't really matter (as much) if it's an object (value) or a reference.
Hack core, cross fingers :D
Comment #51
berdirIf the patch doesn't work, then a different function calls it wrong, so please post the whole eror message.
Comment #52
Max K. commented2nding #50 -- the "prepare" case cannot be ignored.
Comment #53
verta commentedsubscribing (using 6.16)
Comment #54
ar-jan commentedI got this warning too in Drupal 6.16 after migrating to PHP 5.3, when searching for a term.
I applied the patch in #15 on a D6.16 site.
Searching no longer throws a warning so that's worth something ;). I don't know enough to comment on whether this is a proper solution.
Comment #55
n4rky commentedRe #20: I never understand what directory I'm supposed to be in when I apply these patches. Changing to the directory with the actual file and "patch < /tmp/node_search_php53_fix_1.patch" worked for me.
Comment #56
holydrupal commentedworks fine for me 2
Comment #57
yan commentedSame problem running Drupal 6.16 with PHP 5.3.2-1ubuntu4. Patch from #15 solves it.
Comment #58
Einstein27 commented#13: node_search_php53_fix.patch queued for re-testing.
Comment #59
tbm13 commentedPatch #15 fixes the problem for me too.
Why has this patch not been reviewed and applied yet?
Comment #60
heine commentedBecause no-one has reviewed it. All these PHP 5.3 issues collect are inane comments.
The good news is that everyone can review patches. See http://drupal.org/patch/review for a guide.
Comment #61
Reg commentedSubscribing
Comment #62
Reg commentedIt may be more appropriate (and is self-documenting) to address the version conflict more directly with something like below.
This is just an idea for discussion and not tested because I don't have this particular problem but if someone can
test it that would be great. I am interested because it might become a problem since I have PHP 5.3 running and
do have similar problems I am working on.
Comment #63
berdirPlease not again.... :)
- The current code is *wrong*, it does not work correctly in PHP 5.2 either, PHP 5.2 just silently ignores the by reference and uses the parameter as by value. There are no resulting bugs/issues here in 5.2 since $node is not changed with the used $op but it is wrong nevertheless.
- The patch in #15 fixes the problem and works perfectly fine for both 5.2 and 5.3, there is no need to introduce conditional function definitions and stuff like that.
Comment #64
Reg commentedIf it's an existing bug and nothing to do with versions, of course, I agree.
Comment #65
Anonymous (not verified) commentedI just applied the patch w/ success. Note to newbies like me: follow the example in # 20, but make sure you are in the root of your drupal installation before running the final step. Also watch out for the text-wrapping in the example; the 1st command takes up 2 lines. The 2nd command starts '$ patch -p0'
Comment #66
Carlos Miranda Levy commentedI confirm that patch #45 is still needed and works on Drupal 6.16.
Comment #67
Carlos Miranda Levy commentedCurrent node.module version in Drupal 6.16 is 1.947.2.22
// $Id: node.module,v 1.947.2.22 2010/03/03 21:36:37 goba Exp $Patch 15 aims to fix v 1.947.2.19 of node.module
Patch 15 fails.
Comment #68
heine commentedThe patch in #15 still applies with Hunk #1 succeeded at 1285 (offset 5 lines). The patch in #45 makes no sense; see #63.
#15 makes sense, and works in manual tests with PHP 5.3
Comment #69
aaron.r.carlton commentedpatch #15 worked for me using 6.16. Looking forward to this in the next release.
Comment #70
gábor hojtsyGreat, thanks for testing. Committed #15!
Comment #71
Carlos Miranda Levy commentedWhy and how commit when it explicitely fails?
Comment #72
heine commentedWhat do you mean? Per #68, the patch in #15 still applies with a fuzz.
Comment #73
Carlos Miranda Levy commentedIt failed to me, the bot and others.
Comment #74
heine commented"Failed" meaning what exactly? The patch applies and solves the issue.
The qa testbot is not working correctly for Drupal 6.
Comment #75
Carlos Miranda Levy commentedSorry, my bad.
I downloaded a fresh install of 6.16 and patch #15 applied successfully.
Comment #77
ayalsule commented#15 worked for me
Comment #78
klonosI still get the error in latest D6.19 (patch in #15 is included):
warning: Parameter 1 to menu_nodeapi() expected to be a reference, value given in .../includes/module.inc on line 462....but this time it is about menu_nodeapi() instead of comment_nodeapi(). Should I file a separate issue?
Comment #79
klonosComment #80
berdirThat is not the same error.
Your error is related to menu_nodeapi(). That is not called like comment_nodeapi() was. This must be a contrib or even custom module that does this.
Comment #81
klonos...never mind. I did open a new issue here: #886700: Parameter 1 to menu_nodeapi() expected to be a reference, value given in module.inc, line 462 (php 5.3 compatibility)
Comment #82
damien tournoud commentedComment #83
dewancodes commentedYes, It works for me. Big Thanks!
Comment #84
astra commentedMy site got the same problem after upgrading to php5.3:
Try this solution, go to comment.module and change the line (line 276 for D4.7, line 405 for D5):
with new one (just removed "&"):
It seems to fix this problem.