In function globalredirect_init() option 'external' should be set to FALSE (I think) since following message is shown: "There is a notice: Undefined index: external in language.inc on line 109." (locale and i18 module are enabled). Look at core url() function, where language_url_rewrite() is called - 'external' option is always set before call to language_url_rewrite();

Comments

smk-ka’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new860 bytes

Yes, this is annoying. Re-rolled patch with nothing else than whitespace fixed, so it's RTBC.

ranza’s picture

i actually just fixed line 109 by doing if(!isset($options['external'])) {} insted of !$options['e... in language.inc

mrfelton’s picture

That sounds like perhaps a patch to core is what is really needed.

smk-ka’s picture

Title: Option 'external' should be set before language_url_rewrite() is called » Notice thrown if option 'external' not set
Project: Global Redirect » Drupal core
Version: 6.x-1.x-dev » 7.x-dev
Component: Code » language system
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new642 bytes
new630 bytes

Agreed, let's try that: language_url_rewrite() should not throw a notice if $options['external'] is not set.

damien tournoud’s picture

Erm. Why not fixing that in Global redirect? You are calling a core function, it's your responsibility to call it correctly.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Because it's bad code? $options['external'] is an optional property.

damien tournoud’s picture

$options['external'] is an optional property.

It is not, it is set by default in url(), before calling language_url_rewrite().

damien tournoud’s picture

Project: Drupal core » Global Redirect
Version: 7.x-dev » 6.x-1.x-dev
Component: language system » Code
Status: Reviewed & tested by the community » Needs work

It makes zero sense not to fix that in Global redirect first.

mrfelton’s picture

Nothing in http://api.drupal.org/api/function/language_url_rewrite/6 mentions that 'external' is a required option. Surely, just because the parameter is set in url() before the function is called, that doesn't make it a mandatory parameter - that's just the way that url() uses it.

EDIT: Also note that in http://api.drupal.org/api/function/url/6, where the various options are defined (on the language_url_rewrite page it says that the options are the same as for url()) the entire $options array is optional, and if (!isset($options['external'])) is used the check for the presence of the 'external' option.

eMPee584’s picture

Priority: Normal » Critical
Status: Needs work » Reviewed & tested by the community

Just installed this module, and with more than 26 kilo users, surely this module will not throw a PHP notice on EVERY page access, right?

Why has the maintainer still not committed this simple fix?

i was just about to submit this patch too.. Surely the check in core's language_url_rewrite should be fixed aswell (as mrfelton rightly stated, the docs don't mention that 'external' is required....) but first and foremost the problem is caused by the globalredirect module...

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 6.x-1.x and 7.x-1.x. Thanks everyone!
http://drupal.org/cvs?commit=336594
http://drupal.org/cvs?commit=336596

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

eMPee584’s picture

(Nice, it also has been fixed in core.)