(Note: This is a repost of #919904: Destinations is double urlencoded after creating a field for a content type (Secure Pages compatibility issue).)

First off, I apologize if this is wrong place for this issue; I'm not sure where would be the best place to discuss this.

If I attempt to add a field to a content type, after setting the widget options, I am redirected back to the front page with an error saying "warning: array_shift() expects parameter 1 to be array, string given in [...site path...]/modules/cck/includes/content.admin.inc on line 1350."

Going back and testing, I noticed, in the widget options page, the query appended to the url is "?destinations=destinations%255B0%255D%3Dadmin%252Fcontent%252Fnode-type%252F[...content type...]%252Ffields".

The query value decodes to "destinations[0]=admin/content/node-type/[...content type...]/fields", which is the location it should return to minus the array assignment.

So to hack around it, I changed this function in content.admin.inc:

function content_get_destinations($destinations) {
  $query = array();
  $path = array_shift($destinations);
  if ($destinations) {
    $query['destinations'] = $destinations;
  }
  return array($path, $query);
}

To:

function content_get_destinations($destinations) {
  $query = array();
  if ( is_array($destinations) ) {
    $path = array_shift($destinations);
  } else {
    $path = rawurldecode($destinations);
    $path = preg_replace( '/destinations\[\d+\]=/', '', $path );
    unset($destinations);
  }
  if ($destinations) {
    $query['destinations'] = $destinations;
  }
  return array($path, $query);
}

I am sure that the Secure Pages module is culprit, because I have no issues on the test site which is an exact copy minus Secure Pages.

Does anybody have any better suggestions or leads?

Comments

bowwowadmin’s picture

I turned the secure pages off and the error was gone.

astonvictor’s picture

Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks