Issues

ZF-11340: Problem with method assemble() in /library/Zend/Controller/Router/Route/Module.php line 234 when params have an array with two levels

Description

I encounter this problem with the Paginator when i've url with params containing an array with two levels.

The error is : Warning: urlencode() expects parameter 1 to be string, array given in /library/Zend/Controller/Router/Route/Module.php on line 234

When I change the code source :

    foreach ($params as $key => $value) {
        $key = ($encode) ? urlencode($key) : $key;
        if (is_array($value)) {
            foreach ($value as $arrayValue) {
                $arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue;
                $url .= '/' . $key;
                $url .= '/' . $arrayValue;
            }
        } else {
            if ($encode) $value = urlencode($value);
            $url .= '/' . $key;
            $url .= '/' . $value;
        }
    }

by :

if ($encode) { $url .= '?'.http_build_query($params); } else { foreach ($params as $key => $value) { if (is_array($value)) { foreach ($value as $arrayValue) { $url .= '/' . $key; $url .= '/' . $arrayValue; } } else { $url .= '/' . $key; $url .= '/' . $value; } }
}

This solution is not perfect, do you have any other solution ?

Comments

No comments to display