Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just updated to the latest (june 23 2011) dev version, started getting the following message:
Notice: Use of undefined constant LANGUAGE_NEGOTIATION_NONE - assumed 'LANGUAGE_NEGOTIATION_NONE' in fb_url_inbound_alter() (line 152 of /public_html/sites/all/modules/fb/fb_url_rewrite.inc).
Thought you guys should know
Comment | File | Size | Author |
---|---|---|---|
#31 | fb_url_rewrite_d7.diff | 929 bytes | Dave Cohen |
#25 | fb-1197924-language-negotiation.patch | 2.61 KB | Steven Jones |
#21 | 1197924-21.patch | 2.26 KB | jghyde |
#19 | 1197924_fb_url_rewrite.patch | 2.23 KB | alphageekboy |
#17 | 1197924_fb_url_rewrite.patch | 2.18 KB | wesnick |
Comments
Comment #1
Cory Highfield CreditAttribution: Cory Highfield commentedI commented out the following line and the error message disappeared. Not sure if that is the proper fix, but thought I'd share.
// $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
Comment #2
caravinci CreditAttribution: caravinci commentedwell, I knew commenting said line would "fix" it, but I wonder what is it there for to begin with... surely something they're just implementing and is not complete yet?
Comment #3
djv CreditAttribution: djv commentedsubscribe
Comment #4
MacMladen CreditAttribution: MacMladen commentedThat will remove the notice but is by no mean a solution.
I suppose that author just made a typo wanting to put there
LANGUAGE_NEGOTIATION_DEFAULT
as that would serve if we had some problems with getting variablelanguage_negotiation
, so I suggest changing NONE to DEFAULT or make line 152 of/sites/all/modules/fb/fb_url_rewrite.inc
look like this:Sure, this also removes
Notice:...
but is it what author wanted?Maintainters, please respond ASAP to issues like this as this radically breaks a site.
Comment #5
Dave Cohen CreditAttribution: Dave Cohen commentedThis line of code comes from a fix in the 6.x branch that was recently merged into 7.x, and I guess LANGUAGE_NEGOTIATION_NONE disappeared between 6.x and 7.x.
I find it hard to imagine a notice radically breaking a site. Your live website should probably not display php notices. They are usually harmless. And I think modules/fb for 7.x has a handful of php notices that need fixing.
What would be helpful is if someone could find some issue or documentation on d.o that mentions LANGUAGE_NEGOTIATION_NONE, why it was removed in D7 and how to upgrade modules that use it.
Comment #6
JimSmith CreditAttribution: JimSmith commentedFollowing suggested change in line 152 (#4) only changed the error notice. It did not remove it.
The language_negotiation_get function wasn't removed in D7.
http://api.drupal.org/api/drupal/includes--language.inc/function/languag...
Comment #7
BeatnikDude CreditAttribution: BeatnikDude commentedsub'n
Comment #8
Adam Neutrik CreditAttribution: Adam Neutrik commented@jns
I can't reproduce your quote. Changing
to
is def the right step, follows the api correctly and makes the error notice dissapear. (here under d7.4 with latest fb dev shot)
All it needs is a (co-)maintainter putting this little change in the next dev for now. That's it.
Comment #9
Dave Cohen CreditAttribution: Dave Cohen commentedHow do you know for def?
In D6 both constants LANGUAGE_NEGOTIATION_NONE and LANGUAGE_NEGOTIATION_DEFAULT exist. In D7, the latter goes away. Has anyone found any documentation or reason why it was removed?
Comment #10
davidsanger CreditAttribution: davidsanger commentedsubscribe
see also http://drupal.org/node/1060908
I don't know enough about it but it has to do with URL rewriting and those two constants are no longer in D7
Comment #11
shunting CreditAttribution: shunting commented#9:
LANGUAGE_NEGOTIATION_DEFAULT exists in D7. LANGUAGE_NEGOTIATION_NONE is gone.
http://api.drupal.org/api/drupal/includes--language.inc/constant/LANGUAG...
Comment #12
Mujtaba Mir CreditAttribution: Mujtaba Mir commentedI made it correct by just replacing LANGUAGE_NEGOTIATION_NONE with 'LANGUAGE_NEGOTIATION_DEFAULT'.
Two changes
1. DEFAULT instead of NONE
2. write in single quotes i.e., ' '
Comment #13
Dave Cohen CreditAttribution: Dave Cohen commentedI'm not convinced any of this is needed in D7. Does anyone out there have a site that actually uses language prefixes?
Comment #14
Ambient.ImpactSubscribing. Still present in latest dev (2011-Jul-18).
Comment #15
wesnick CreditAttribution: wesnick commentedPatch #13 totally hoses url_aliases.
I don't have time to look into it in depth yet, but I am sure the last snippet of code that was removed should stay in, with $path_language = NULL;
@Dave Cohen, you really like this C-style control structure without curly braces, any reason for not hewing to Drupal coding standards?
Comment #16
Dave Cohen CreditAttribution: Dave Cohen commentedThat helps.
I don't pretend to understand the language stuff in Drupal. At the moment I'm fortunate enough to not be supporting any multi-language facebook apps. In both D6 and D7 big changes were made to core and its hard to keep up. I'm counting on patches tested by the community to make it work.
My understanding in D7 is that url alters are a hook, so the language modules can do their own thing and modules/fb should not have to do it for them. Thats why I tried to take out all the language code.
You're welcome to submit a new issue, with a patch.
Comment #17
wesnick CreditAttribution: wesnick commentedSorry, didn't mean to sound snarky, and you are probably right that "totally hoses" is not the best idiom. At any rate, I am no expert on i18n either, but it seems that the url rewriting schemes are the same while the underlying API has changed. Until someone with a need for this on D7 comes forward, with some example scenario, then I think the majority of the patch from #13 is appropriate, ie, just remove the bulk of the code related to i18n. Attached a revised patch that leaves the last bit of the conditional, so that url_aliases are fetched and processed.
Comment #18
webankit CreditAttribution: webankit commented+1
Comment #19
alphageekboy CreditAttribution: alphageekboy commentedHere is an updated version for the 7/31/2011 dev release of the FB module.
Comment #20
mhamed CreditAttribution: mhamed commentedHi all
i ve got the same notice but changing NONE to DEFAULT
has produced the error twice:
**** Notice: Use of undefined constant LANGUAGE_NEGOTIATION_DEFAULT - assumed 'LANGUAGE_NEGOTIATION_DEFAULT' in fb_url_inbound_alter() (line 152 of /..../sites/all/modules/fb/fb_url_rewrite.inc).
****Notice: Use of undefined constant LANGUAGE_NEGOTIATION_DEFAULT - assumed 'LANGUAGE_NEGOTIATION_DEFAULT' in fb_url_inbound_alter() (line 152 of /..../sites/all/modules/fb/fb_url_rewrite.inc).
Commented the line:
// $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_DEFAULT);
but here is the persistent message that can not stop emerging everywhere even in the client interface:
****fbconnect module is already enabled, choose the fbconnect module in the facebook stream settings page
Comment #21
jghyde CreditAttribution: jghyde commentedThis patch is against the master (as of 8/30/2011) and fixes #20 as well.
Joe
Comment #22
theullrich CreditAttribution: theullrich commentedSo what is the final decision? Just comment it out?
Comment #23
Dave Cohen CreditAttribution: Dave Cohen commentedIt would be nice to hear whether patch #21 works. I'm testing with it, but don't have multiple languages set up.
Comment #24
SolomonGifford CreditAttribution: SolomonGifford commentedWorks for me - but I'm not using multiple languages either.
Comment #25
Steven Jones CreditAttribution: Steven Jones commentedHmm..that patch doesn't seem to play nice with path aliases, as it specifically undoes any path un-aliasing done further up the stack.
This hook is supposed to be the 'opposite' of what happens in hook_url_outbound_alter, which it currently isn't, as it has all the language stuff in it. In theory you can ignore all that and just focus on your little bit of the path.
I've attached a patch that does just that, and works for me. I've not got it set up with language stuff, but that won't actually play nice with anyone's path re-writing at the moment anyway, so you can't fully test it out. In theory, you shouldn't have to care about what other modules (including language) are doing, so we shouldn't need to have any language code in our function.
Comment #26
jghyde CreditAttribution: jghyde commentedpatch #25 tested and appears good, with path aliases enabled and used.
Comment #27
jakonore CreditAttribution: jakonore commentedsub
Comment #28
garrettrayj CreditAttribution: garrettrayj commentedsub
Comment #29
jessepinho CreditAttribution: jessepinho commented+1
Comment #30
Dave Cohen CreditAttribution: Dave Cohen commentedChecked it in. Glad to be rid of the language code. Thanks guys!
I do wonder, with the new facebook oauth implementation... maybe the url rewriting can be removed entirely. In the past it was needed because sometimes canvas pages gave no indication that they were a canvas page request. If there is now always a signed request, and if that signed request always identifies which app, this url rewriting hack can be avoided. I just haven't had time to look into that (and unclear whether I ever will).
Comment #31
Dave Cohen CreditAttribution: Dave Cohen commentedHmmm... url rewrite is broken. I'm not sure if the patch above was bad, or I applied it badly (I may have had other changes already there). Anyway I'm trying to repair url altering again.
Comment #32
giorgio79 CreditAttribution: giorgio79 commentedHey Dave, now that canvas pages are deprecated in favor of iframe apps, do we need rewriting at all?
Language detection can be handled by i18n.
Comment #33
Dave Cohen CreditAttribution: Dave Cohen commentedMarking this as fixed because I've just pushed my latest fb_url_rewrite.inc live. The previous patch had bugs, don't bother applying it. Instead, test the latest .dev release. If you find it is broken, please submit another issue. The LANGUAGE_NEGOTIATION_NONE is fixed. (the question is whether anything else is broken in the process.)
In the current release, canvas pages and page tabs need the url rewriting (just facebook connect, you don't need it). It is possible with the latest oauth changes from facebook that maybe we could do without rewriting. That would be nice, but I'm not certain everything will work. I think that's something for a 4.0 release...