Hi,

I get this error when I access a view generated page:

Fatal error: Cannot use object of type view as array in
/sites/all/modules/securepages/securepages.module on line 134

Even when I switch back to non-secure http.

thanks :-)
Bo

Comments

rismondo’s picture

Status: Active » Needs review

I found the same bug today; some code inspection revealed the following:

in securepages.module, in the function:

/**        
 * Implementation of hook_link_alter()
 */
function securepages_link_alter(&$node, &$links) {
  foreach ($links as $module => $link) {                            
    if ($link['href']) { 
[...]

the test should really be:

    if (is_array($links) && $link['href']) { 

This fixes the bug on my version (6.x) of securepages.

sciman’s picture

I wonder if this is not related to the issue I just reported

http://drupal.org/node/285999

The fix there was this:

change

if ($link['href']) {

to

if ($link->href) {

fletchgqc’s picture

Same bug experienced.

pariviere’s picture

This fix works for me

fletchgqc’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too. Please commit, maintainer-man.

By the way I'm going to hijack this issue to mention that there's an error with the "installation successful" text on installation - the happy green text refers to !setting which I guess is supposed to be !settings or something that will get dynamically replaced.

jhedstrom’s picture

StatusFileSize
new577 bytes

Instead of simply checking for $link being an array, the attached patch casts $link to an array so as not to lose out on the behavior for modules that pass $link as an object.

grendzy’s picture

The patch in #6 worked for me.

Thanks!

jhedstrom’s picture

Priority: Normal » Critical

Is there any reason not to apply this patch? It's a trivial fix to a fatal error...

sreese’s picture

The patch in #6 fixed an issue for me in the 5.x version as well. Views urls were not being handled properly but upon applying the patch, all is well again. Please commit for the 5.x version too!

pasc’s picture

StatusFileSize
new634 bytes

I just had the same issue as well, but I disagree with the patches posted above. The function definition for the link_alter hook is wrong in the securepages module and doesn't match
http://api.drupal.org/api/function/hook_link_alter

I've attached a patch that sets it right.

Changing that definition fixed the problems for me.

pasc’s picture

Title: conflict with Views 6.x-2.0-beta3 » broken link_alter_hook causes conflict with at least Views 2.0

Changed title

I've also marked as the duplicates the following:
#301265: hook_link_alter is broken in Drupal 6 (contains slightly different patch)
#301008: Compatibility with Node Vote

triclops’s picture

Subscribing

Markpanzee’s picture

I was experiencing the same problem. The patch in #10 seems to have fixed this problem for me.

gordon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks this has been committed.

j0rd’s picture

This bug still exists in DRUPAL-6--1-7-BETA1 . Problem is with hook_link_alter definition as mentioned above.

-function securepages_link_alter(&$node, &$links) {
+function securepages_link_alter(&$links, $node) {

^-- is the fix. Simple. I hope this simple fix to a fatal error gets resolved, committed and a new version is sent out to the public.

Status: Fixed » Closed (fixed)

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