After logged in, I've got following error:

    * warning: parse_url() expects exactly 1 parameter, 2 given in contributions/path_redirect/path_redirect.module on line 340.
    * warning: parse_url() expects exactly 1 parameter, 2 given in contributions/path_redirect/path_redirect.module on line 341.

Comments

kenorb’s picture

Status: Active » Needs review

It's problem on PHP4. Second parameter has been added with PHP 5.1.2
http://uk3.php.net/parse_url
So there should be dependency for PHP5.

My solution was to install http://drupal.org/project/php4 and change following lines:

    'query' => parse_url($path, PHP_URL_QUERY),
    'fragment' => parse_url($path, PHP_URL_FRAGMENT),

to:

    'query' => parse_url_compat($path, PHP_URL_QUERY),
    'fragment' => parse_url_compat($path, PHP_URL_FRAGMENT),
stevenpatz’s picture

Status: Needs review » Active

There is no patch to review.

kenorb’s picture

There is as well some other alternative function:

function parseUrl ( $url )
{
    $r  = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
    $r .= '(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';

    preg_match ( $r, $url, $out );

    return $out;
}

Available at: http://uk.php.net/parse_url

kenorb’s picture

Or solution could be just to delete second argument.

dave reid’s picture

Assigned: Unassigned » dave reid

Thanks for the report! I'll get this fixed today.

dave reid’s picture

Status: Active » Fixed

Fixed using:

Index: /home/dave/Projects/www/drupal6dev/sites/all/modules/path_redirect/path_redirect.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/path_redirect/path_redirect.module,v
retrieving revision 1.3.2.7.2.46
diff -u -p -r1.3.2.7.2.46 path_redirect.module
--- path_redirect.module	17 Mar 2009 20:51:27 -0000	1.3.2.7.2.46
+++ path_redirect.module	30 Apr 2009 15:35:40 -0000
@@ -335,10 +335,11 @@ function _path_redirect_split_path($path
     $path = preg_replace('/&/', '?', $path, 1);
   }
 
+  $parsed = parse_ul($path);
   $result = array(
     'path' => preg_replace('/[\?\#].*$/', '', $path),
-    'query' => parse_url($path, PHP_URL_QUERY),
-    'fragment' => parse_url($path, PHP_URL_FRAGMENT),
+    'query' => $parsed['query'],
+    'fragment' => $parsed['fragment'],
   );
   return $result;
 }

http://drupal.org/cvs?commit=205208

kenorb’s picture

Thank you.

dave reid’s picture

Thanks for the bug report kernorb!

Status: Fixed » Closed (fixed)

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